Belajar Dasar Python Bab 2 if conditional

#Bab02 If and Conditional def main(): nama= input('Masukkan Nama Karyawan: ') nik= input('Masukkan Nik Karyawan: ') stat= input('Karyawan (Staff/Honor): ') if(stat=='Staff'): gaji=10000000 gol = input('Golongan (A/B/C): ') if(gol=='A'): bonus=1000000 elif(gol=='B'): bonus=750000 elif(gol=='C'): bonus=500000 else: print('Golongan yang Anda Masukkan Salah') elif(stat=='Honor'): gaji=5000000 gol = input('Golongan (A/B/C): ') if(gol=='A'): bonus=400000 elif(gol=='B'): bonus=300000 elif(gol=='C'): bonus=200000 else: print('Golongan yang Anda Masukkan Salah') else: print('Tidak ada karyawan yang dimaksud') return main() gatot=gaji+bonus taxe=gaji*(0.5) total=gatot-taxe print('Gaji = Rp%.2f' %gaji) print('Boonus = Rp%.2f' %bonus) print('Pajak = Rp%.2f' %taxe) print('Total Take Home Rp%.2f' %total) if __name__ == '__main__': #memanggil metode main main()

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.