-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path34. program dictionary.py
More file actions
49 lines (37 loc) · 1.14 KB
/
34. program dictionary.py
File metadata and controls
49 lines (37 loc) · 1.14 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# input data terus print
import os
import string
import random
template_mahasiswa = {
"nama":"mahasiswa",
"prodi":"PROD001",
"nrp":"0000000",
"sks":146,
}
mahasiswa_kosong = {
}
while True:
# os.system("cls")
# print(template_mahasiswa)
mahasiswa = dict.fromkeys(template_mahasiswa)
mahasiswa["nama"] = input("Masukkan Nama :")
mahasiswa["nrp"] = input("Masukkan Nrp :")
mahasiswa["prodi"] = input("Masukkan Prodi :")
mahasiswa["sks"] = int(input("Masukkan Sksmu :"))
print(f'{"Key":<5} {"Nama":<16} {"NRP":<8} {"Prodi":<16} {"SKS":<4}')
print("=="*50)
KEY = ''.join(random.choice(string.ascii_uppercase) for i in range(10))
mahasiswa_kosong.update({KEY:mahasiswa})
for mahasiswa in mahasiswa_kosong:
KEY = mahasiswa
NAMA = mahasiswa[KEY]['nama']
NRP = mahasiswa[KEY]['nrp']
PRODI = mahasiswa[KEY]['prodi']
SKS = mahasiswa[KEY]['sks']
print(f'{KEY:<5} {NAMA:<16} {NRP:<8} {PRODI:<16} {SKS:<4}')
lanjut = input("Lanjut? Y/N")
if lanjut == N:
break
else:
continue
# print(mahasiswa)