Guest User

Untitled

a guest
May 18th, 2016
1,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.61 KB | None | 0 0
  1. # Ask the user the required info
  2. nr_people = raw_input("How many people are coming to your party?") # people
  3. pizza = raw_input("What's the price of pizza?") # pizza price
  4. juice = raw_input("What's the price of juice?") # juice price
  5.  
  6. # Now you have to convert to int or float
  7. # people to int
  8. # and prices to float, because they can be 10.5 or 2.43
  9. nr_people = int(nr_people)
  10. pizza = float(pizza)
  11. juice = float(juice)
  12.  
  13. # store the result
  14. result = nr_people * pizza + nr_people * juice * 2
  15.  
  16. # convert the result to str
  17. result = str(result)
  18.  
  19. # print everything
  20. print "You have to pay " + result + " dollars."
Advertisement
Add Comment
Please, Sign In to add comment