File tree Expand file tree Collapse file tree 4 files changed +69
-0
lines changed
modul-5/250441100128_NazroatulFardaini_Modul5_KakAngga Expand file tree Collapse file tree 4 files changed +69
-0
lines changed Original file line number Diff line number Diff line change 1+ def hitung_harga_motor (nama , bulan , harga ):
2+ pajak = 0.10 * harga
3+ if bulan == "september" :
4+ diskon = 0.5 * harga
5+ elif bulan == "oktober" :
6+ diskon = 0.10 * harga
7+ else :
8+ diskon = 0
9+ total_harga_motor = harga - diskon + pajak
10+ return total_harga_motor
11+ nama = input ("masukkan nama motor: " )
12+ bulan = input ("masukkan bulan: " )
13+ harga = int (input ("masukkan harga motor: " ))
14+
15+ hasil = hitung_harga_motor (nama , bulan , harga )
16+ print (f"total harga motor{ nama } yang membeli pada bulan{ bulan } adalah Rp { hasil } " )
17+
18+
19+
20+
Original file line number Diff line number Diff line change 1+ def faktorial (n ):
2+ if n == 1 :
3+ return 1
4+ else :
5+ return n * faktorial (n - 1 )
6+ n = int (input ("masukkan angka: " ))
7+ print (f"faktorial dari { n } adalah { faktorial (n )} " )
Original file line number Diff line number Diff line change 1+ def hitung_gaji (nama , jabatan , gaji_pokok ):
2+ pajak = 0.05 * gaji_pokok #5%
3+ if jabatan == "manager" :
4+ tunjangan = 0.10 * gaji_pokok #10%
5+ elif jabatan == "staff" :
6+ tunjangan = 0.05 * gaji_pokok #5%
7+ else :
8+ tunjangan = 0
9+ gaji_bersih = gaji_pokok - pajak + tunjangan
10+ return gaji_bersih
11+
12+ nama = input ("masukkan nama karyawan: " )
13+ if nama != "0123456789" :
14+ print ("nama tidak boleh angka, hanya berupa huruf, mohon masukkan kembali" )
15+ nama = input ("masukkan nama karyawan: " )
16+
17+ jabatan = input ("masukkan jabatan (manager/staff): " ).lower ()
18+
19+
20+ gaji_pokok = float (input ("masukkan gaji pokok: " ))
21+ if gaji_pokok < 0 :
22+ print ("hanya masukkan bialangan positif, mohon masukkan kembali" )
23+ gaji_pokok = float (input ("masukkan gaji pokok: " ))
24+ hasil = hitung_gaji (nama , jabatan , gaji_pokok )
25+ print (f"gaji bersih { nama } sebagai { jabatan } adalah Rp{ hasil } " )
Original file line number Diff line number Diff line change 1+ def cek_anagram (kata1 , kata2 ):
2+
3+ return sorted (kata1 ) == sorted (kata2 )
4+
5+ kata1 = input ("Masukkan kata pertama: " )
6+ kata2 = input ("Masukkan kata kedua: " )
7+
8+ hasil = cek_anagram (kata1 , kata2 )
9+
10+ print (f"Kata pertama : { kata1 } " )
11+ print (f"Kata kedua : { kata2 } " )
12+ print ("Apakah anagram?" , hasil )
13+
14+ if hasil :
15+ print ("Kedua kata merupakan anagram." )
16+ else :
17+ print ("Kedua kata bukan anagram." )
You can’t perform that action at this time.
0 commit comments