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 RĂ©ponses
+ 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