mardi 6 mars 2018

Simple "if" statement that I need explained?

Im learning if statements. I wrote this code and ran it. It seems that lines 2 and 3 are ignored. When I enter a number lower than 45 it dosent prompt lines 2 and 3. I hope you understand what I mean.

price = input('How much did your taxi ride cost?:')
if price < 45:
  print('Processing')
if price > 45:
      response = ('Your taxi cost over $45 you will be charged a $5.00 fee')
      print(response)
      response = input('Would you like to proceed:')
      if response == 'yes': 
        print('Processing...')
if response == 'no':
    print('!Error!')

Aucun commentaire:

Enregistrer un commentaire