First
This commit is contained in:
7
Acara-10/loop.py
Executable file
7
Acara-10/loop.py
Executable file
@@ -0,0 +1,7 @@
|
||||
angka = [1,2,3,4,5,6,7,8,9,10]
|
||||
jumlah = 0
|
||||
|
||||
for i in angka:
|
||||
jumlah = jumlah + i
|
||||
|
||||
print ('jumlah =', jumlah)
|
||||
6
Acara-10/lopping.py
Executable file
6
Acara-10/lopping.py
Executable file
@@ -0,0 +1,6 @@
|
||||
jumlah = 5
|
||||
|
||||
while jumlah > 0:
|
||||
print (jumlah)
|
||||
jumlah -= 1
|
||||
print("selesai")
|
||||
5
Acara-10/nasted-loop.py
Executable file
5
Acara-10/nasted-loop.py
Executable file
@@ -0,0 +1,5 @@
|
||||
for baris in range(5):
|
||||
for kolom in range(7):
|
||||
print('*', end=' ')
|
||||
else :
|
||||
print('')
|
||||
13
Acara-10/while-true.py
Executable file
13
Acara-10/while-true.py
Executable file
@@ -0,0 +1,13 @@
|
||||
angka = 0
|
||||
while True :
|
||||
print(angka)
|
||||
angka = angka + 1
|
||||
|
||||
if angka == 2:
|
||||
print("skip")
|
||||
continue
|
||||
|
||||
if angka == 5:
|
||||
print ("break")
|
||||
break
|
||||
print("selesai")
|
||||
Reference in New Issue
Block a user