Skip to content

Instantly share code, notes, and snippets.

@Mathsmaniac
Created June 8, 2021 03:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mathsmaniac/874491ae41a120435c156df98233b236 to your computer and use it in GitHub Desktop.
Save Mathsmaniac/874491ae41a120435c156df98233b236 to your computer and use it in GitHub Desktop.
the one about movie tickets
totalprice = 0
counta = 0
counts = 0
countc = 0
countg = 0
while True:
yesno = input("Do you want to sell a ticket? (Y/N)")
if yesno == 'N' or yesno == 'n':
break
print('What ype of ticket do you want')
print('A for Adult, or')
print('S for Student, or')
print('C for Child, or')
print('G for Gift voucher')
type = input(">>")
confirm=input('Confirm purchase of {} ticket? (Y/N)'.format(type.upper()))
if confirm == 'N' or confirm == 'n':
counta = counta
else:
if type == 'a' or type == 'A':
totalprice += 12.50
counta += 1
elif type == 's' or type == 'S':
totalprice += 9.00
counts += 1
elif type == 'C' or type == 'c':
totalprice += 7.00
countc += 1
elif type == 'G' or type == 'g':
totalprice = totalprice
countg += 1
else:
print('That was not a valid input, quitting to main menu')
print('The total tickets sold today was {}'.format(counta + counts + countc + countg))
print('This was made up of:')
print('{} for adults; and'.format(counta))
print('{} for students; and'.format(counts))
print('{} for children; and '.format(countc))
print('{} for gift vouchers'.format(countg))
print('\nSales for the day came to ${:.2f}'.format(totalprice))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment