forked from noviwdd/Python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kasir.py
82 lines (77 loc) · 2.42 KB
/
kasir.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import sys
total = []
print("--------------------------")
print("KASIR AA")
print("-------------------------------")
def daftar_barang():
print(" No | Nama Barang | Harga")
print("-------------------------------")
print(" 1 | Downy | 23000")
print(" 2 | Baygon | 41100")
print(" 3 | Mamy Poko | 59000")
print(" 4 | Ovaltine | 23000")
print(" 5 | Beras | 70000")
print("-------------------------------")
kode = int(input("Masukkan angka barang : "))
if kode == 1:
jumlah1 = int(input("Masukkan jumlah barang : "))
total1 = 23000 * jumlah1
total.append(total1)
tanya()
elif kode == 2:
jumlah2 = int(input("Masukkan jumlah barang : "))
total2 = 41100 * jumlah2
total.append(total2)
tanya()
elif kode == 3:
jumlah3 = int(input("Masukkan jumlah barang : "))
total3 = 59000 * jumlah3
total.append(total3)
tanya()
elif kode == 4:
jumlah4 = int(input("Masukkan jumlah barang : "))
total4 = 23000 * jumlah4
total.append(total4)
tanya()
elif kode == 5:
jumlah5 = int(input("Masukkan jumlah barang : "))
total5 = 70000 * jumlah5
total.append(total5)
tanya()
return
def tanya():
print("\n-------------------------------")
tanya = input("Ingin tambah barang? [y/t] : ")
print("-------------------------------")
if tanya == "y":
daftar_barang()
elif tanya == "t":
akhir()
else:
print("Pilihan yang anda masukan salah!")
def akhir():
for harga in total:
print("SubTotal : ", sum(total))
diskon = 0
a = sum(total)
if a > 500000:
diskon = a * 8/100
elif a > 300000:
diskon = a * 5/100
elif a > 200000:
diskon = a * 3/100
elif a > 100000:
diskon = a * 1/100
else:
diskon = 0
print("Potongan Harga : ", diskon)
totalakhir = a - diskon
print("Total : ", totalakhir)
print("-------------------------------")
bayar = int(input("Bayar : "))
kembalian = bayar - totalakhir
print("Kembalian : ", kembalian)
print("-------------------------------")
print(" Terima Kasih ")
print("-------------------------------")
daftar_barang()