Nov-28-2021, 02:08 AM
Hello friends, I'm new here.
I am still a beginner but I am quite familiar with loops and while statement and have used it many times.
I'm trying a simple exercise but the result only shows when the number I type exists in the list, otherwise I get an error which I don't understand :
Thank you
I am still a beginner but I am quite familiar with loops and while statement and have used it many times.
I'm trying a simple exercise but the result only shows when the number I type exists in the list, otherwise I get an error which I don't understand :
list = [1,3,4,6,7] number = int(input("Pick a number : ")) i=0 while list[i] != number : if i < len(list) : i = i+1 else : print("your numeber has not been found") print(f"the position of your number is {i}")Could you please help me understand which part of my while statement is not correct ?
Thank you
