SHARE
TWEET

Untitled

a guest Dec 13th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. dataMhs = {}
  2.  
  3.  
  4. def tambahDataMhs(npm, nama, jurusan, kelas):
  5.     result = dataMhs.update({npm: [nama, jurusan, kelas]})
  6.     return result
  7.  
  8.  
  9. def tampilDataMhs(cetak):
  10.  
  11.     if(len(dataMhs) != 0):
  12.         if dataMhs.get(cetak, None):
  13.             print("======== [ Cetak Data Mahasiswa ] =======")
  14.             for k, v in (dataMhs[cetak]):
  15.                 print(k+": ".join(v))
  16.                 print("="*20)
  17.                 return cetak
  18.         else:
  19.             print("======== [ Cetak Data Mahasiswa ] =======")
  20.             for k, v in dataMhs.items():
  21.                 print(k+": "+str(v))
  22.                 print("="*20)
  23.     else:
  24.         print("belum ada data terisi")
  25.  
  26.  
  27. def ambilDataMhs():
  28.     print("======== [ List Data Mahasiswa ] =======")
  29.     print("\n".join(v for v in dataMhs.keys()))
  30.  
  31.  
  32. while 1:
  33.     print("1. Tambah Data Mahasiswa \n2. Cek Data Mahasiswa\n3. Cetak")
  34.     tanyaMenu = input("Pilih Menu :")
  35.     if(tanyaMenu == "1"):
  36.         data = tambahDataMhs(input("Masukkan NPM: "),
  37.                              input("Masukkan Nama: "), input("Masukkan Jurusan: "), input("Masukkan Kelas "))
  38.     elif(tanyaMenu == "2"):
  39.         ambilDataMhs()
  40.     elif(tanyaMenu == "3"):
  41.         cetak = tampilDataMhs(
  42.             input("Cetak semua atau masukkan salah satu npm : "))
  43.     else:
  44.         print("Tidak ada menu")
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