Python code question

Asked 2 years ago, Updated 2 years ago, 50 views

one_more_input = "yes"
user_select = one_more_input.lower()

    if(user_select is "yes" or user_select is "y"):
        result = True
    else:
        result = False

print(result)

We are creating a function that returns True if "Y" or "YES" regardless of case, but we want to make the output value true, but we keep printing False. How do I do this?

python string

2022-09-22 13:48

1 Answers


one_more_input ="yes"
user_select = one_more_input.lower() #

if(user_select == "yes" or user_select == "y"):
    result = True

else:
    result = False

print(result)


Change the identification operator is to the relational operator ==.


2022-09-22 13:48

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.