순서열

Posted by PeEn
2019. 5. 26. 22:59 Programing/Python

range(끝값)

ex)

for num in range(3) :
    print(num)
----------
0
1
2


range(시작값,끝값)

ex)
for y in range(1,10):
    print(2, 'x', y, '=', 2*y)
------
2 x 1 = 2
2 x 2 = 4
........
2 x 9 = 18


ex)
roses = ['하얀장미','하얀장미','하얀장미']
for j in range(3):
    roses[j] = '빨간장미'
print(roses)

---------
['빨간장미','빨간장미','빨간장미']

'Programing > Python' 카테고리의 다른 글

while문  (0) 2019.05.27
if문  (0) 2019.05.26
논리형  (0) 2019.05.26
반복문 for  (0) 2019.05.26
Python LIST  (0) 2019.05.26