Output :
Masukkan Data
Kode barang =01
Nama Barang =meja
Masukkan Entry Lagi ? (Y/N) =n
cari kode =01
['01', 'meja']
#Sourcecode
def data():
data=[]
pilih ="Y"
while pilih == "Y":
print("Masukkan Data")
kd = input("Kode barang =")
nm = input("Nama Barang =")
a = data.append([kd,nm])
pilih = input("Masukkan Entry Lagi ? (Y/N) =")
return(data)
def caridata(data, cari):
found=0
for x in range(len(data)):
for y in range(len(data)):
if data[x][y]==cari:
print(data[x])
found=found+1
if found == 0 :
print("tidak ditemukan")
a = data()
b = input("cari kode =")
caridata(a,b)