-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBelajar31-Program-List.py
More file actions
28 lines (15 loc) · 999 Bytes
/
Belajar31-Program-List.py
File metadata and controls
28 lines (15 loc) · 999 Bytes
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
## Buat Program List Buku
list_buku = []
while True: # Loop / Pengulangan Program
print("\n====Masukan Data Buku====")
judul = input("Masukan Judul Buku\t: ") # Input
penulis = input("Masukan Nama Penulis\t: ") # Input
new_book = [judul,penulis] # Jadikan Satu 2 Data input Kedalam 1 Variable
list_buku.append(new_book) # Menyimpan Data baru Dari Varibale Jadi Satu (input) Kedalam Variale Yg Memiliki List Kosong
print("No.\t| Judul\t\t\t| Penulis") # Mengatur Tata Letak Yg Pas Dengan Tab
for index,book in enumerate(list_buku): # Mengambil Index dan Data Yg Disimpan Di Variable List Kosong Dgn enumerate
print(f"{index+1}\t| {book[0]}\t\t| {book[1]}") # Menampilkan Setiap Index +1, Data Judul, Data Penulis
lanjut = input("Apakah Lanjut Mencari?(y/n) > ") # WARNING
if lanjut == "n": # Jika "n" Maka Program Akan Berhenti
break # Jika Selain "n" Maka Program Akan Terus Berlanjut
print("PROGRAM SELESAI")