Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Conditional statements


Great. Another Boolean operator that is frequently used is or:

has_credit_card = input('Do you have a credit card [y/n]? ')
has_debit_card = input('Do you have a debit card [y/n]?')

if (has_credit_card == 'y' or has_debit_card == 'y'):
  print('We are happy to accept your payment.')
  print('Sorry, we cannot accept your payment.')

When we use or, the if code will be executed if at least one of the conditions is satisfied (i.e., at least one condition is True).


Imagine you are at an amusement park. A child needs to be shorter than 130 cm or weigh less than 45 kg to ride a carousel.

Write a program that will ask the user for two variables: height and weight. If any child is below the limit, write: You can take a ride!. If not, write: Sorry, you cannot take a ride!.