As you are trying to read the integer values stored on your "numbers_list" by a string value of "1" , so the if loop will fail always.
You can try , with 2 ways :
You can try , with 2 ways :
#One way numbers = list(range(1,11)) #range(1,10) or range(1,11) based on your requirement print(numbers) for num in numbers: if(num==1): print(num) elif(num==2): print(num) else: if(num==3): print(num) else: continue #Second way for num in numbers: if(num<=3): print(num) else: continue
buran write Dec-03-2020, 09:00 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.