Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Data

a guest Apr 7th, 2020 130 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. global kode,nama,harga,stok,kodes,namas,hargas,stoks
  4. kodes = []
  5. namas = []
  6. hargas = []
  7. stoks = []
  8.  
  9. def banner():
  10.  print """
  11. Jumlah Data : %s
  12. 1. Menambah Barang
  13. 2. Menampilkan Barang
  14. 3. Mengedit Barang
  15. 4. Menghapus Barang
  16. """%(str(len(kodes)))
  17.  pil = input("> Masukan Pilihan : ")
  18.  if pil == 1:
  19.   tambah()
  20.  elif pil == 2:
  21.   tampil()
  22.  elif pil == 3:
  23.   edit()
  24.  elif pil == 4:
  25.   hapus()
  26.  else:
  27.   print "Salah Input"
  28.  
  29. def tambah():
  30.  global kode,nama,harga,stok,kodes,namas,hargas,stoks
  31.  kode = raw_input("> Kode Barang : ")
  32.  nama = raw_input("> Nama Barang : ")
  33.  harga = raw_input("> Harga Barang : ")
  34.  stok = raw_input("> Stok Barang : ")
  35.  kodes.append(kode)
  36.  namas.append(nama)
  37.  hargas.append(harga)
  38.  stoks.append(stok)
  39.  print "Success Tambah Data Barang "
  40.  banner()
  41. def tampil():
  42. # 1,beras,5000,4
  43. # 2,air,1000,3
  44.  print """
  45. [ Kode Barang ][ Nama Barang ][ Harga Barang ][ Stok Barang ]
  46. """
  47.  banyak = len(namas)
  48.  for x in range(banyak):
  49.   print "  "+kodes[x],"\t\t",namas[x],"\t\t",hargas[x],"\t\t",stoks[x]
  50.  banner()
  51. def edit():
  52.    k = input("Masukan Data Keberapa Barang Yang Mau Diedit : ")
  53.    ok = len(kodes)
  54.    if k > ok:
  55.     print "Data Tidak Sebanyak Itu!"
  56.     banner()
  57.    l = k-1
  58.    kode = raw_input("Masukan Kode Ganti : ")
  59.    nama = raw_input("Masukan Nama Ganti : ")
  60.    harga = raw_input("Masukan Harga Ganti : ")
  61.    stok = raw_input("Masukan Stok Ganti : ")
  62.    kodes[l] = kode
  63.    namas[l] = nama
  64.    hargas[l] = harga
  65.    stoks[l] = stok
  66.    print "Succes Edit Data Ke",k
  67.    banner()
  68. def hapus():
  69.  k = input("Hapus Data Ke? : ")
  70.  ok = len(kodes)
  71.  if k > ok:
  72.   print "Data Tidak Sebanyak Itu!"
  73.   banner()
  74.  l = k-1
  75.  kodes.pop(l)
  76.  namas.pop(l)
  77.  hargas.pop(l)
  78.  stoks.pop(l)
  79.  print "Success Delete Data Ke",k
  80.  banner()
  81. banner()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top