0

How can I indexing out of the for loop

def char_level(): choose = int(input("Pick level in range 1-6 : ")) level = [1,2,3,4,5,6] for j in level: j*=10 print(j[0]) char_level()

24th May 2021, 1:26 AM
Yohanes Prasdya
Yohanes Prasdya - avatar
2 ответов
+ 1
Do level[0]. If you want to print it only once, put the statement out of the for loop.
24th May 2021, 3:20 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 2
Now, j are [10,20,30,40,50,60] I want to print out 10, how to do that?
24th May 2021, 2:27 AM
Yohanes Prasdya
Yohanes Prasdya - avatar