You cannot use "return" unless outside a function. You have no functions so you cannot use return.
You could write a function like this:
ordered_list = [2, 4, 6, 8, 10]
def guess_in_list(guess, ordered_list):
for element in ordered_list:
if element == guess:
return True
else:
return False
guess = input('Guess a number: ')
That wouldn't work at all for many reasons. The first being that input returns a string and your ordered list contains numbers (integers). The second reason being that it only looks at the first element in the list.
ordered_list = [2, 4, 6, 8, 10]
def guess_in_list(guess, ordered_list):
for element in ordered_list:
if element == guess:
return True
return False
guess = int(input('Guess a number: '))
print(guess_in_list(guess, ordered_list))
That works, but it ignores a useful list operation. You should always work on increasing you familiarity with a programming language. The more you know the better your code.
ordered_list = [2, 4, 6, 8, 10]
def guess_in_list(guess, ordered_list):
return guess in ordered_list
guess = int(input('Guess a number: '))
print(guess_in_list(guess, ordered_list))
And now that we are down to a one line function there is no reason to have a function.
ordered_list = [2, 4, 6, 8, 10]
guess = int(input('Guess a number: '))
print(guess in ordered_list)
As long as we are at it, why use a variable name like "ordered_list". Variable names should describe the thing they reference, not the thing's type.
even_numbers = [2, 4, 6, 8, 10]
guess = int(input('Guess a number: '))
if guess in even_numbers:
print(guess, 'is an even number in the range 2 to 10')