Skip to content

Commit

Permalink
Update (4.5)
Browse files Browse the repository at this point in the history
  • Loading branch information
reighpuy committed Nov 29, 2022
1 parent e10b5e4 commit ef0cf73
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions Data/users.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Muhamad Khadaffy,dapi,123
Daffy,dapii,123
Daffy2,dapiii,123
Daffy3,dapi3,123
Daffy4,dapi4,123
12 changes: 9 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def jeda(durasijeda): # dengan parameter jumlah durasi jeda-nya
time.sleep(durasijeda) # eksekusi perintah jeda
os.system("cls") # Clear screen menggunakan modul os


# ====== FUNGSI MENU ======
def MenuPertama():
jeda(1)
Expand Down Expand Up @@ -179,8 +178,12 @@ def lihatstokbuku():
for i, v in enumerate(file, start=1):
# '.split("#")', untuk memisahkan kata dengan menggunakan pemisah #
a, b, c = v.split("#")
c = int(c)
# 'end' memaksa menggantikan newline dengan nonkarakter
print(f"{i}. {a} ({b}) - Stok: {c}", end="")
if c == 0:
print(f"{i}. {a} ({b}) - Stok: Tidak tersedia", end="\n")
else:
print(f"{i}. {a} ({b}) - Stok: {c}", end="\n")

# Memunculkan stok buku by Kode Buku
def jumlahstok(Kodebuku):
Expand All @@ -190,7 +193,10 @@ def jumlahstok(Kodebuku):
l_no += 1
a, b, c = line.split("#")
c = int(c)
return c
if c == 0:
return 'Tidak tersedia'
else:
return c

# Fungsi mengurangkan stok buku ketika buku dipinjam
def kuranginstokbuku(Kodebuku):
Expand Down

0 comments on commit ef0cf73

Please sign in to comment.