Rabu, 18 Januari 2017

Python in Range

0
1
2
3
4
------------------------
3
4
5
------------------------
4
6
8
------------------------
0
-2
-4
-6
-8
------------------------
>>>

Dengan code sbb:

for i in range(5):
    print(i)
print("------------------------")

for i in range(3, 6):
    print(i)
print("------------------------")

for i in range(4, 10, 2):
    print(i)
print("------------------------")

for i in range(0, -10, -2):
    print(i)
print("------------------------")




Tidak ada komentar:

Posting Komentar