In: Computer Science
Prompt the user for their name, get and store the user input.
Prompt the user for their age, get and store the user input. We will assume that the user will enter a positive integer and will do no error checking for valid input.
Determine and store a movie ticket price based on the user's age. If their age is 12 or under, the ticket price is $5. If their age is between 13 and 64, inclusive, the ticket price is $10. If their age is 65 or greater, the ticket price is $8.
When all the user input has been gathered, print out a meaningful label such as 'Name: ' followed by the entire user name on one line. On the next line, print out a meaningful label such as 'Age: ' followed by the user's age. On the next line, print out a meaningful label such as 'Ticket Price: ' followed by the ticket price your program calculated. Your output should look something like this:
Name: Mickey M Mouse
Age: 19
Ticket Price: $10
Python 3
if __name__ == '__main__': # User Input name = input("Enter your name : ") age = int(input("Enter your age : ")) # declaration of price varaiable to 0 price = 0 # condition ;check if age <= 12: price = 5 elif age >=13 or age >=64: price = 10 elif age >=65: price = 8 # Display the output print("\nName : ", name) print("Age : ", age) print("Ticket Price : ", price)