Computer Science, asked by amnahhassan06, 3 months ago

A particular zoo determines the price of admission based on the age of the guest. Guests 2 years of age and less are admitted without charge. Children between 3 and 12 years of age cost $14.00. Seniors aged 65 years and over cost $18.00. Admission for all other guests is $23.00. Create a program that begins by reading the ages of all of the guests in a group from the user, with one age entered on each line. The user will enter a blank line to indicate that there are no more guests in the group. Then your program should display the admission cost for the group with an appropriate message. The cost should be displayed using two decimal places.

Answers

Answered by avigarg1412
2

Answer:

sum = 0

while True:

   age = input("Please enter the age of Group members one by one \nNote: If no more member available please press ENTER key: ")

   if age == "":

       break

   else:

       age_int = int(age)

       if age_int < 2:

           sum = sum + 0

       elif age_int>3 and age_int<13:

           sum = sum + 14

       elif age_int>14 and age_int<65:

           sum = sum + 23

       else:

           sum = sum + 18

sum_dec = "{:.2f}".format(sum)

print("The total fair of your group is ",sum_dec)

Explanation:

While loop is used since we dont know Group size.

Answered by syed2020ashaels
0

Answer:

Given below is the code

Explanation:

sum = 0

while True:

  age = input("Please enter the age of Group members one by one \nNote: If no more member available please press ENTER key: ")

  if age == "":

      break

  else:

      age_int = int(age)

      if age_int < 2:

          sum = sum + 0

      elif age_int>3 and age_int<13:

          sum = sum + 14

      elif age_int>14 and age_int<65:

          sum = sum + 23

      else:

          sum = sum + 18

sum_dec = "{:.2f}".format(sum)

print("The total fair of your group is ",sum_dec)

See more:

https://brainly.in/question/25672378

#SPJ2

Similar questions