Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.64 KB | None | 0 0
  1.  
  2. first_name = input("Please enter your first name: ").capitalize()
  3. first_answer = input("Hi {}, do you want to go to the beach? (y/n): ".format(first_name)).capitalize()
  4.  
  5. if first_answer == "Y":
  6.     current_temp = int(input("Please tell me the current temperature: "))
  7.     min_temp = int(input("What is the minimum temperature for going to the beach? "))
  8.    
  9.     if current_temp >= min_temp:
  10.         print ("You can go to the beach because it is {} degrees.".format(current_temp))
  11.         second_answer = input("Do you want to buy an ice cream? (y/n): ")
  12.        
  13.         if second_answer == "y":
  14.             current_cash = input("How much cash do you have? ")
  15.            
  16.             if current_cash > "0":
  17.                 ice_cream = input("How much is an ice cream? ")
  18.                
  19.                 if current_cash >= ice_cream:
  20.                     ice_cream = float(ice_cream)
  21.                     current_cash = float(current_cash)                    
  22.                     left_over = current_cash - ice_cream
  23.                     print ("You can buy an ice cream and you will have ${:.2f} left.".format(left_over))
  24.                     print ("Enjoy your time at the beach.")
  25.                 else:
  26.                     print ("Sorry, no ice cream today.")
  27.                     print ("Enjoy your time at the beach.")
  28.             else:
  29.                 print ("Please remember to bring cash next time.")
  30.                 print ("Enjoy your time at the beach.")
  31.         else:
  32.             print ("Enjoy your time at the beach.")
  33.     else:
  34.         print ("It's not warm enough, stay at home.")
  35. else:
  36.     print("Ok, enjoy your time at home.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement