print ('masukan skor: ')
skor = int (input ())
if skor >= 80 and skor <= 100:
indeks = 'A'
elif skor >= 50 and skor < 80:
indeks = 'B'
elif skor >= 30 and skor < 50:
indeks = 'C'
elif skor >= 0 and skor < 30:
indeks = 'D'
print ('indeks nilai anda: ' , indeks)
else:
print('nilai tidak valid')
kenapa else nya dianggap invalid syntax?
0 jempol
bramanto
300
1167
·
5 tahun, 9 bulan yang lalu
·
1 jempol
Halo coder @mzahidh, untuk print-nya kamu bisa menuliskannya lebih menjorok kedalam seperti ini:
print ('masukan skor: ')
skor = int (input ())
if skor >= 80 and skor <= 100:
indeks = 'A'
elif skor >= 50 and skor < 80:
indeks = 'B'
elif skor >= 30 and skor < 50:
indeks = 'C'
elif skor >= 0 and skor < 30:
indeks = 'D'
print ('indeks nilai anda: ' , indeks)
else:
print('nilai tidak valid')