Advertisement
Schleimpilz

Pythonübung

May 20th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.41 KB | None | 0 0
  1. import math as m
  2. priceTotal=0
  3. answer=("y")
  4.  
  5. while answer==("y"):
  6.     print("do you want a ticket? (y/n)")
  7.     answer=input()
  8.  
  9.     if answer==("y"):
  10.         print ("how old are you?")
  11.         age=int(input())
  12.  
  13.         if age<12:
  14.             price=8
  15.         else:
  16.             price=12
  17.    
  18.         print("would you like to watch the movie in 3d? (y/n)")
  19.         answer2=input()
  20.  
  21.         if answer2==("y"):
  22.             price=price+3
  23.  
  24.         print("what row would you like to sit in?")
  25.         X=int(input())
  26.  
  27.         if X>5:
  28.             price=price+3
  29.  
  30.         if age>12:
  31.             print("are you a student or retired? (y/n)")
  32.             answer3=input()
  33.             if answer3==("y"):
  34.                 price=(m.floor(0.8*price))
  35.         print("Price per ticket: {}$".format(price))
  36.  
  37.         satz1=("You just configured a ticket for {}$. You will sit in row {}".format(price,X))
  38.  
  39.         if answer2==("y"):
  40.             satz2=(", your movie will be in 3D ")
  41.         else:
  42.             satz2=("")
  43.  
  44.         if answer3==("y"):
  45.             satz3=(", and you are a student or you already retired!")
  46.         else:
  47.             satz3=(".")
  48.  
  49.         print(satz1+satz2+satz3)
  50.         print("how many of those tickets do you want?")
  51.         amount=input()
  52.         price=(int(amount)*price)
  53.        
  54.         priceTotal=priceTotal+price
  55.        
  56.        
  57.  
  58. print ("Total Price: {}$".format(priceTotal))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement