Last active
November 12, 2024 22:34
-
-
Save ZoeS17/a00c501d96f16f71afea7b48236a0614 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
TICKETPRICE = 2.50 | |
EVENINCREASE = 0.2 | |
def calc_math(afternoon_attendence): | |
ticket_revenue = afternoon_attendence * TICKETPRICE | |
evening_attendence = (afternoon_attendence * EVENINCREASE) + afternoon_attendence | |
if (evening_attendence > 350): | |
evening_attendence = 350 | |
else: | |
if evening_attendence % 3 > 0: | |
import math | |
evening_attendence = math.ceil(evening_attendence) | |
#calc evening revenue | |
evening_revenue = TICKETPRICE * evening_attendence | |
return ticket_revenue, evening_attendence, evening_revenue | |
def main(): | |
afternoon_attendence = int(input("How many people attended in the afternoon? ")) | |
if 350 < afternoon_attendence > 0: | |
print(f"Number must be between 0 - 350. You gave `{afternoon_attendence}`") | |
else: | |
w, x, y = calc_math(afternoon_attendence) | |
print(f"${w:,.2f} {x:.0f} ${y:,.2f}") | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment