Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- needed_beers = int(input())
- delivered_beers = 0
- command = input()
- while command != "Exam Over":
- package = command.split(' ')
- amount = int(package[0])
- type = package[1]
- if type == "sixpacks":
- amount *= 6
- elif type == "cases":
- amount *= 24
- delivered_beers += amount
- command = input()
- delivered_beers -= int(delivered_beers / 100)
- diff = abs(needed_beers - delivered_beers)
- cases = int(diff / 24)
- sixpacks = int(diff % 24 / 6)
- beers = int(diff % 6)
- if delivered_beers >= needed_beers:
- print(f"Cheers! Beer left: {cases} cases, {sixpacks} sixpacks and {beers} beers.")
- else:
- print(f"Not enough beer. Beer needed: {cases} cases, {sixpacks} sixpacks and {beers} beers.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement