-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathubahjin.py
32 lines (27 loc) · 927 Bytes
/
ubahjin.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
from globalvar import *
def ubahjin():
username = input("Masukkan username jin: ")
if(usertersedia):
index = cariidxuser(username)
if(listrole[index] == "pengumpul"):
roleubahke = "pembangun"
else:
roleubahke = "pengumpul"
masukan = input(f"Jin ini bertipe “{listrole[index]}”. Yakin ingin mengubah ke tipe “{roleubahke}” (Y/N)? ")
if(masukan == "Y"):
listrole[index] = roleubahke
print("Jin telah berhasil diubah.")
elif(masukan == "N"):
print("Jin tidak jadi diubah.")
else:
print("Tidak ada jin dengan username tersebut.")
def usertersedia(username):
for i in range (102):
if(username == listuser[i]):
return False
return True
def cariidxuser(username):
for i in range (102):
if(username == listuser[i]):
return i
return -1