Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Ahmad Dzikrul Fikri
1806196806-DDP1
Commits
d2e91716
Commit
d2e91716
authored
Apr 16, 2020
by
Ahmad Dzikrul Fikri
Browse files
Tugas Pemrograman 2 - Soal 2 Tahap 2
parent
98ca2590
Changes
1
Show whitespace changes
Inline
Side-by-side
TP8_2_1806196806.py
View file @
d2e91716
...
...
@@ -15,14 +15,17 @@ def get_koperasi(minimal_pesan,huruf_beruntung):
diskon_pelanggan_setia
=
16000
*
int
(
jumlah
)
*
0.2
diskon_huruf_beruntung
=
(
16000
*
int
(
jumlah
)
-
diskon_pelanggan_setia
)
*
0.1
cashback
=
diskon_pelanggan_setia
+
diskon_huruf_beruntung
jumlah_cashback
+=
cashback
harga
=
16000
*
int
(
jumlah
)
-
cashback
elif
lower_nama
.
startswith
(
huruf_beruntung
)
==
True
:
cashback
=
16000
*
int
(
jumlah
)
*
0.1
jumlah_cashback
+=
cashback
harga
=
16000
*
int
(
jumlah
)
-
cashback
elif
int
(
jumlah
)
>
minimal_pesan
:
cashback
=
16000
*
int
(
jumlah
)
*
0.2
jumlah_cashback
+=
cashback
harga
=
16000
*
int
(
jumlah
)
-
cashback
else
:
...
...
@@ -36,6 +39,7 @@ def get_koperasi(minimal_pesan,huruf_beruntung):
for
keys
in
hash_result
.
keys
():
data_baru
.
write
(
keys
+
' '
+
str
(
hash_result
[
keys
])
+
'
\n
'
)
data_baru
.
close
()
print
(
'Jumlah uang yang dibutuhkan untuk cashback:'
,
int
(
jumlah_cashback
))
except
TypeError
:
print
(
'input ke dalam file harus berupa string'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment