0

I'm relatively new to the Python and stackoverflow community and would like some help on a particular problem I've been finding when writing my first "helloworld file".

The problem is that is that I can't find a way to print one answer from two different input string outcomes...

if information == ("Yes" or "yes") : #still trying to figure out how to make the program respond with "Ok" with both the inputs, "Yes" and "yes"
print('Ok')
print('Ok')

Any help/answers would be greatly appreaciated.

3 Answers3

0

You can check for inclusion:

if information in ("Yes", "yes"):
    print('Ok')

or:

if information.lower() == "yes":
    print('Ok')
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
0
if information == "Yes" or information == "yes":
    print('Ok')
    print('Ok')

or

if information in ('yes', 'Yes', 'YES'):
    print('Ok')
    print('Ok')

another way is:

if information.lower() == "yes":
    print('Ok')
    print('Ok')

or a lazy way:

if information.lower().startwith("y"):
    print('Ok')
    print('Ok')

Hope it work as expected

Taku
  • 31,927
  • 11
  • 74
  • 85
-1

Try this

if information == "Yes" or information == 'yes': 

Hope this helps

Jay Parikh
  • 2,419
  • 17
  • 13