def get_count(prompt):
"""Ask with prompt; return a whole number 0 or more."""
text = input(prompt)
while not text.isdigit():
print("Please enter a whole number like 0, 1 or 2.")
text = input(prompt)
return int(text)
def ticket_cost(adults, children):
"""Return the cost: adults $12, children $6."""
return adults * 12 + children * 6
def show_receipt(adults, children, cost):
"""Print a one-line receipt."""
print(f"{adults} adults, {children} children: ${cost:.2f}")
def main():
adults = get_count("Adults: ")
children = get_count("Children: ")
cost = ticket_cost(adults, children)
show_receipt(adults, children, cost)
main()