Skip to content

Commit 9860af9

Browse files
authored
Merge pull request #107 from iniadidtya/main
250441100026_MuhammadAdidtyaPutraRamadhan_modul-4_Kaksalman
2 parents 05d2505 + f5cbe22 commit 9860af9

File tree

3 files changed

+80
-0
lines changed

3 files changed

+80
-0
lines changed

modul-4/soal-1.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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.")

modul-4/soal-2.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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"\nHari 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)

modul-4/soal-3.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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()

0 commit comments

Comments
 (0)