-3

I am new to Python, and I want to know how can I add more than one value after ==?

Here is the code:

gender = input('Are You Male Or Female ? ')

if gender.capitalize() == 'Male':
    print('You Got 10000 Rs')

elif gender.capitalize() == 'Female':
    print('You Got 5000 Rs')

else:
    print('You Got 1000 Rs')

As you can see, the elif has 'Female' after ==. What if I want to add another value after 'Female'?

Garrett Hyde
  • 5,409
  • 8
  • 49
  • 55
SMT
  • 1

1 Answers1

0

You can use or keyword.

    gender = input('Are You Male Or Female ? ')

    if gender.capitalize() == 'Male':
        print('You Got 10000 Rs')

    elif gender.capitalize() == 'Female' or gender.capitalize() == 'Others':
        print('You Got 5000 Rs')

    else:
        print('You Got 1000 Rs')

Output:

    Are You Male Or Female ? Others
    You Got 5000 Rs
Sachin Gupta
  • 186
  • 1
  • 14