#asking for input from userpersonal information assigns to a variable my_name = input("What is your name?") my_addr = input("What is your address?") my_city = input("What is your city?") my_state = input("What is your state?") #ask the user for the number of tickets to be purchased my_quantity = int(input("How many tickets do you want to purchase? ")) # calculate ticket cost to purchaser and add in tax. Finally display #the cost to user ticket_price = (int(15)) total_ticket = int((ticket_price * my_quantity)) total_price = (total_ticket * 1.07) message_display = ("The total cost of yur purchase comes to $") #print the users name print('Purchaser name is %s ' % my_name) #print the total cost print('$%s is your total for your order' % total_price) # I am starting with my calculations for tax s_tax = .07 tax_calc = (total_ticket * s_tax) t_sale = (total_ticket + tax_calc) #creating my bill of sale print('%s is the purchaser name' % my_name) print('%s is the purchaser address' % my_addr) print('% is the purchaser city' % my_city) print('% is the purchaser state' % my_state)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question