Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ticketsLeft = 100
- transactions = 0
- while ticketsLeft > 0:
- print('# of tickets')
- ticketsNow = int(input())
- if ticketsLeft == 0:
- break
- if ticketsNow > ticketsLeft:
- print('there are only ' + str(ticketsLeft) + ' tickets left')
- continue
- if ticketsNow <= int(4):
- print('you bought ' + str(ticketsNow) + ' tickets')
- ticketsLeft = ticketsLeft - ticketsNow
- transactions = transactions + 1
- else:
- print('You can only purchase 4 tickets at a time')
- print('no tickets left')
- print('There were ' + str(transactions) + ' transactions.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement