i want to see an output based on the dictionary with input values.
here's the code :
list_harga = {'private':100000,'group':50000}
list_harga
name = str(input('nama: '))
member = str(input('member: '))
tipe_kelas = str(input('kelas: '))
harga=[list_harga[x] for x in tipe_kelas]
harga
i encounter an error :
KeyError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_15824\2571049863.py in <module>
8 print(tipe_kelas)
9
---> 10 harga=[list_harga[x] for x in tipe_kelas]
11 harga
~\AppData\Local\Temp\ipykernel_15824\2571049863.py in <listcomp>(.0)
8 print(tipe_kelas)
9
---> 10 harga=[list_harga[x] for x in tipe_kelas]
11 harga
KeyError: 'g'
the expected output is, when tipe_kelas is private then it will come 100000.
am I missing something?