Fakultas Ilmu Komputer UI

Commit e9869187 authored by Ahmad Dzikrul Fikri's avatar Ahmad Dzikrul Fikri
Browse files

Tugas Pemrograman 7 - Tahap 3 - 1806196806

parent 0caf9463
def urut_data(angka_minimal):
def urut_harga_data(huruf):
try:
data = open('input_order2.txt')
data_akhir =''
......@@ -6,10 +6,16 @@ def urut_data(angka_minimal):
data_input =[]
for line in data:
nama, jumlah = line.split()
data_input.append(nama+' '+jumlah)
lower_nama = nama.lower()
if lower_nama.find(huruf) != -1:
harga = 16000*int(jumlah)
diskon = 0.1*harga
tagihan = int(harga - diskon)
else:
tagihan = int(16000*int(jumlah))
data_input.append(nama+' '+jumlah+' '+str(tagihan))
data_order.append(jumlah)
data_order.sort(reverse=True)
data.close()
if data_order[0] == data_order[-1]:
for index in range(len(data_input)):
......@@ -18,16 +24,11 @@ def urut_data(angka_minimal):
for i in range(len(data_order)):
if data_order[i] != data_order[i-1]:
for index in range(len(data_input)):
if data_input[index].find(data_order[i]) != -1 :
if data_input[index].find(data_order[i]+' ') != -1 :
data_akhir += data_input[index] + '\n'
data_baru= open('TP7_output2_1806196806.txt','w')
awal = 0
akhir = 0
for line in range(minimal):
akhir = data_akhir.find('\n', awal)
data_baru.write(data_akhir[awal:akhir]+'\n')
awal = akhir + 1
data_baru= open('TP7_output3_1806196806.txt','w')
data_baru.write(data_akhir)
data_baru.close()
except:
print("None")
......@@ -35,9 +36,9 @@ def urut_data(angka_minimal):
uji_eror = True
while uji_eror == True:
try :
minimal = int(input("masukkan jumlah data dengan order tertinggi yang ingin anda lihat :"))
minimal = input("masukkan karakter huruf untuk customer yang beruntung :").lower()
uji_eror = False
except :
print("input harus berupa angka tanpa alfabet")
print("None")
urut_data(minimal)
\ No newline at end of file
urut_harga_data(minimal)
\ No newline at end of file
EIFLA 500
NAWE 499
LEAH 499
ELLIOT 498
EVA 497
EIFLA 500 7200000
NAWE 499 7185600
LEAH 499 7185600
ELLIOT 498 7171200
EVA 497 7156800
LAUREN 497 7156800
HARRY 496 7936000
YPPOP 495 7920000
HENRY 494 7113600
ISABELLA 492 7084800
NOSAM 489 7824000
CHARLOTTE 487 7012800
CAASI 485 7760000
SIENNA 485 6984000
YLLOH 481 7696000
BETHANY 480 6912000
AIRAM 478 7648000
MORGAN 478 7648000
LOUIS 477 7632000
YMA 477 7632000
EITAK 477 6868800
YELIAB 476 6854400
ISOBEL 476 6854400
ADLITAM 474 7584000
YECAL 468 6739200
REBMA 466 6710400
ACCEBER 463 6667200
NAIK 463 7408000
ALISHA 457 7312000
AMELIA 456 6566400
EILLOH 455 6552000
NAGOL 453 7248000
NATHAN 453 7248000
FREYA 451 6494400
EISOR 450 6480000
YLIME 446 6422400
YELIR 445 6408000
YAJ 443 7088000
EOZ 442 6364800
HARRIET 437 6292800
YCUL 437 6992000
YLIL 436 6976000
HTEBAZILE 433 6235200
EIMAJ 433 6235200
LUCAS 432 6912000
LOGAN 432 6912000
IMOGEN 428 6163200
LIAM 428 6848000
COREY 428 6163200
AMME 426 6134400
OWEN 422 6076800
ALICE 419 6033600
BLAKE 418 6019200
NODNARB 415 6640000
LIAGIBA 412 6592000
EILRAHC 410 5904000
SACUL 410 6560000
NORAA 406 6496000
SEMAJ 405 5832000
LIBBY 404 6464000
REECE 404 5817600
ZARA 401 6416000
MOHAMMAD 400 6400000
RUBY 396 6336000
BOCAJ 394 6304000
FINLEY 393 5659200
HARVEY 393 5659200
JAKE 392 5644800
MUHAMMAD 392 6272000
POPPY 392 6272000
YBOT 392 6272000
MOLLY 390 6240000
RONNOC 390 6240000
BEN 388 5587200
TTELRACS 386 5558400
SIWEL 385 5544000
NOSIDAM 384 6144000
WEHTTAM 383 5515200
SARAH 382 6112000
NOTHSA 381 6096000
AIVILO 377 6032000
ANNA 377 6032000
CAITLIN 376 6016000
REUBEN 376 5414400
YBUR 374 5984000
MARTHA 374 5984000
AYAM 373 5968000
JASMINE 371 5342400
KAZ 368 5888000
YALNIF 365 5840000
LUCA 360 5760000
SKYE 355 5112000
JOE 352 5068800
DAVID 351 5616000
SEBASTIAN 349 5025600
NEBUER 345 4968000
YLLIB 344 5504000
NAGEM 343 4939200
EILLE 341 4910400
AIGROEG 341 4910400
HTIAF 340 5440000
DAMMAHOM 340 5440000
JACK 340 5440000
YSIAD 340 5440000
BRANDON 337 5392000
LILY 337 5392000
ISABEL 335 4824000
NYLEVE 334 4809600
ECNEROLF 334 4809600
SAMOHT 333 5328000
CAMERON 333 4795200
NICOLE 329 4737600
NAES 324 4665600
EMILY 324 4665600
AIHPOS 321 5136000
JOHN 321 5136000
SOPHIE 320 4608000
ALLEBASI 320 4608000
YENTRUOC 318 4579200
LILLY 316 5056000
JOEL 310 4464000
TOBY 305 4880000
LEOJ 303 4363200
MADA 303 4848000
ALEX 302 4348800
MULLAC 300 4800000
DAISY 299 4784000
YRRAH 298 4768000
SAM 298 4768000
DYLAN 298 4768000
ACUL 296 4736000
MILLIE 295 4248000
NEDYAJ 295 4248000
ALLE 295 4248000
HPESOJ 292 4204800
NIMAJNEB 291 4190400
LEBASI 288 4147200
NAGROM 288 4608000
JACOB 285 4560000
RILEY 284 4089600
REBECCA 277 3988800
EMILIA 277 3988800
GRACE 277 3988800
EKALB 276 3974400
EYKS 275 3960000
ELIZABETH 273 3931200
RACSO 273 4368000
EKUL 273 3931200
NAITSABES 273 3931200
LOLA 271 4336000
XAM 268 4288000
ELLIS 266 3830400
YBBIL 264 4224000
NIRE 263 3787200
ESME 263 3787200
FAITH 262 4192000
YNAHTEB 262 3772800
NEB 261 3758400
BRADLEY 261 3758400
LAYLA 261 4176000
LUKE 258 3715200
JAYDEN 256 3686400
EKAJ 256 3686400
YLLIT 253 4048000
ACSECNARF 253 3643200
SUMMER 252 3628800
NEDYAH 250 3600000
CONNOR 248 3968000
PHOEBE 248 3571200
NOSIRRAH 247 3952000
MAISIE 247 3556800
SYHR 247 3952000
OSCAR 245 3920000
MARIA 244 3904000
NAHTE 244 3513600
AARON 243 3888000
TILLY 241 3856000
NOEL 240 3456000
EBEOHP 237 3412800
OLIVIA 235 3760000
ECILA 232 3340800
EIDDERF 231 3326400
AILUJ 228 3648000
EDWARD 227 3268800
DRAWDE 225 3240000
BENJAMIN 223 3211200
WILLIAM 220 3520000
ROLYAT 219 3504000
LYDIA 218 3488000
ALEXANDRA 216 3110400
ACISSEJ 215 3096000
FRANCESCA 215 3096000
ROBERT 212 3052800
JESSICA 207 2980800
EIHPOS 207 2980800
NIAMH 205 3280000
EGROEG 200 2880000
ZACHARY 194 3104000
ARAZ 193 3088000
ZOE 193 2779200
EGIAP 191 2750400
HAYDEN 189 2721600
SILLE 187 2692800
ARIEK 178 2563200
YEROC 177 2548800
BILLY 176 2816000
ECARG 174 2505600
NOSIDDAM 174 2784000
NAREIK 174 2505600
MICHAEL 172 2476800
MAILLIW 171 2736000
JULIA 170 2720000
MAYA 169 2704000
HOLLY 168 2688000
IXEL 168 2419200
OEL 167 2404800
AMBER 165 2376000
ELYK 164 2361600
MATILDA 163 2608000
AHSILA 163 2608000
LEXIE 162 2332800
EMSE 160 2304000
XELA 160 2304000
TIA 157 2512000
JAY 155 2480000
ETHAN 155 2232000
EIBBA 152 2188800
ADAM 152 2432000
GRACIE 150 2160000
DANIEL 149 2145600
AIT 147 2352000
JAMES 147 2116800
ELEANOR 142 2044800
TAYLOR 142 2272000
KAI 141 2256000
FREDDIE 139 2001600
AHTRAM 139 2224000
EVIE 137 1972800
MOHAMMED 133 1915200
THOMAS 132 2112000
RYAN 125 2000000
COURTNEY 124 1785600
EVE 123 1771200
TOILLE 122 1756800
AUHSOJ 120 1920000
LEBOSI 119 1713600
ALSI 117 1872000
FLORENCE 116 1670400
ALICIA 113 1808000
KIAN 110 1760000
NILTIAC 109 1744000
MAX 107 1712000
YRAHCAZ 107 1712000
NAVE 103 1483200
CHARLIE 101 1454400
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment