Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
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
5b8d8ce6
Commit
5b8d8ce6
authored
Mar 09, 2020
by
Ahmad Dzikrul Fikri
Browse files
Tugas Pemrograman 6 - Tahap 2 - 1806196806
parent
b24d3ec4
Changes
1
Hide whitespace changes
Inline
Side-by-side
TP6_1806196806.py
View file @
5b8d8ce6
import
urllib.request
from
random
import
randint
def
cari_nilai
(
pilihan
,
kesulitan
):
page
=
urllib
.
request
.
urlopen
(
"https://baguspribadi99.github.io/difficulty/difficulty.html"
)
...
...
@@ -35,20 +36,15 @@ while hp_student>0 or hp_kuliah>0 :
print
(
"Sayang sekali anda telah dimakan oleh beratnya tugas kuliah!"
)
hp_kuliah
=
0
if
hp_kuliah
>
0
:
jawaban
=
True
while
jawaban
==
True
:
action
=
input
(
"Masukkan action untuk kuliah!! :"
).
lower
()
if
action
==
'serang'
:
hp_student
-=
attack_kuliah
print
(
"Deadline menghantui student, HP student berkurang sebanyak"
,
attack_kuliah
)
jawaban
=
False
elif
action
==
'bertahan'
:
hp_kuliah
+=
attack_kuliah
print
(
"Ada revisi, HP kuliah bertambah sebanyak"
,
attack_kuliah
)
jawaban
=
False
else
:
print
(
action
,
"tidak termasuk kedalam pilihan.(serang atau bertahan"
)
jawaban
==
True
serangan
=
randint
(
0
,
1
)
if
serangan
==
0
:
hp_student
-=
attack_kuliah
print
(
"Deadline menghantui student, HP student berkurang sebanyak"
,
attack_kuliah
)
elif
serangan
==
1
:
hp_kuliah
+=
attack_kuliah
print
(
"Ada revisi, HP kuliah bertambah sebanyak"
,
attack_kuliah
)
else
:
print
(
action
,
"tidak termasuk kedalam pilihan.(serang atau bertahan"
)
else
:
print
(
"Selamat anda telah mengalahkan tugas-tugas kuliah!"
)
hp_student
=
0
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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