File tree Expand file tree Collapse file tree 3 files changed +80
-0
lines changed Expand file tree Collapse file tree 3 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ print ("Program Kondisi Lampu di Taman Kota" )
2+ jumlah_baris = int (input ("Masukkan jumlah baris lampu: " ))
3+
4+ for baris in range (1 , jumlah_baris + 1 ):
5+ print ()
6+ jumlah_lampu = int (input (f"Masukkan jumlah lampu pada baris ke-{ baris } : " ))
7+ for lampu in range (1 , jumlah_lampu + 1 ):
8+ if lampu % 3 == 0 :
9+ print (f"Lampu ke-{ lampu } pada baris { baris } rusak." )
10+ else :
11+ print (f"Lampu ke-{ lampu } pada baris { baris } menyala." )
12+ if baris == jumlah_baris :
13+ print ("*" * 50 )
14+ print ("Periksa sambungan daya utama." )
Original file line number Diff line number Diff line change 1+ print ("Program Hitung Gaji Mingguan" )
2+
3+ total_gaji = 0
4+ total_lembur = 0
5+ total_bonus_shift = 0
6+ total_upah_lembur = 0
7+
8+ for hari in range (1 , 8 ):
9+ print (f"\n Hari ke-{ hari } " )
10+ shift_malam = input ("Apakah shift malam? (y/n): " )
11+ if shift_malam == "y" :
12+ jam_lembur = int (input ("Masukkan jam lembur: " ))
13+ else :
14+ jam_lembur = 0
15+
16+ gaji_pokok = 100000
17+ bonus_shift = 0
18+ upah_lembur = 0
19+ if jam_lembur == 0 :
20+ upah_lembur = 0
21+ elif jam_lembur <= 3 :
22+ upah_lembur = jam_lembur * 25000
23+ elif jam_lembur == 4 :
24+ upah_lembur = 100000
25+ elif jam_lembur == 5 :
26+ upah_lembur = 125000
27+ elif jam_lembur == 6 :
28+ upah_lembur = 200000
29+ elif jam_lembur == 7 :
30+ upah_lembur = 225000
31+ elif jam_lembur == 8 :
32+ upah_lembur = 300000
33+ else :
34+ print ("Jam lembur melebihi batas, tidak dihitung." )
35+ upah_lembur = 300000
36+
37+ if shift_malam == "y" :
38+ bonus_shift = 50000
39+
40+ total_gaji += gaji_pokok + bonus_shift + upah_lembur
41+ total_lembur += jam_lembur
42+ total_bonus_shift += bonus_shift
43+ total_upah_lembur += upah_lembur
44+ gaji_pokok = gaji_pokok * 7
45+
46+ print ("=== Rekap Gaji Mingguan ===" )
47+ print ("Total jam lembur:" , total_lembur , "jam" )
48+ print ("Total upah lembur: Rp" , total_upah_lembur )
49+ print ("Total bonus shift malam: Rp" , total_bonus_shift )
50+ print ("Total gaji pokok: Rp" , gaji_pokok )
51+ print ("--------------------------------" )
52+ print ("Total gaji selama seminggu: Rp" , total_gaji )
Original file line number Diff line number Diff line change 1+ print ("Pola Piramida Cermin" )
2+ n = int (input ("Masukkan angka n: " ))
3+
4+ for i in range (n , 0 , - 1 ):
5+
6+ for j in range (1 , i + 1 ):
7+ print (f"{ j :2} " , end = " " )
8+
9+ for k in range ((n - i ) * 6 ):
10+ print (" " , end = "" )
11+
12+ for j in range (i , 0 , - 1 ):
13+ print (f"{ j :2} " , end = " " )
14+ print ()
You can’t perform that action at this time.
0 commit comments