how to Write a program that asks the user to enter the number of people he wants to compute the ticket price for. Then, your program should ask the user to enter the age for each person and calculate the ticket price of each entered age using the given formula, then display the result with two digits after the decimal point.๐๐๐๐๐๐ก ๐๐๐๐๐ = โ๐๐๐ + 10ย
n = int(input('number of people: '))
for i in range(n):
ย ย age = int(input(f'age of person {i+1}: '))
ย ย coast = age**(1/2) + 10
ย ย print(f"the ticket price for {i+1} person is {coast:.2f}")
Comments
Leave a comment