Answer to Question #242499 in Python for Gopi

Question #242499
Suppose you are planning to go to park so you are going to check tickets criteria online. The
ticket rates details have been given
*If children below 10 are not allowed to swing
*If age is between 10 to 15 allowed to swing and getting 10 % discount
*If age is between 15 to 20 allowed to swing and getting 5 % discount
*If age is more than 20 not then not eligible for swing and discount
The age of person will run until you enter the age of last family member and then calculate the total charge amount after entering each person’s age. Assume price of ticket is 100 Rs. each
person.
1
Expert's answer
2021-09-26T11:41:03-0400
n = int(input('Enter total number of family members '))
price = 0
for i in range(n):
    j = int(input('Enter the age of each family member '))
    if j < 10:
        print('Not allowed to swing')
        price = price + 100
    elif 10 <= j < 15:
        print('Allowed to swing')
        price = price + 90
    elif 15 <= j <= 20:
        print('Allowed to swing')
        price = price + 95
    else:
        print('Not allowed to swing')
        price = price + 100
print('The total charge for your family is {} Rs.'.format(price))

Enter total number of family members 6
Enter the age of each family member 48
Not allowed to swing
Enter the age of each family member 25
Not allowed to swing
Enter the age of each family member 23
Not allowed to swing
Enter the age of each family member 21
Not allowed to swing
Enter the age of each family member 15
Allowed to swing
Enter the age of each family member 12
Allowed to swing
The total charge for your family is 585 Rs.


    
   

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS