write a python program to calculate the total amount a family of N members should pay to attend the fair. use iterative statements to accept the age of each family member and based on the age calculate the total final amount the family should pay after discount.
AGE below 6 ,Ticket price is rs.20.
AGE 6 to 9 ,Ticket price is. rs. 30.
AGE 10 to 17, Ticket price is rs. 50.
AGE 18 and above,Ticket price is rs 100.
discount amount=0.05* Ticket price.
Answers
n = int(input("Enter the number of family members: "))
print()
l = list()
for i in range(n):
a = int(input("Enter the age of the member: "))
l.append(a)
print()
print()
amt = 0
for i in l:
if i < 6:
tp = 20
amt += tp - (tp*0.05)
elif i >= 6 and i <= 9:
tp = 30
amt += tp - (tp*0.05)
elif i >= 10 and i <= 17:
tp = 50
amt += tp - (tp*0.05)
else:
tp = 100
amt += tp - (tp*0.05)
print("The total amount to be paid is: ", amt)
Program:
no_of_members=int(input("Enter no.of members going to attend the fair: "))
total_amount=0
for i in range(no_of_members):
age=int(input("Enter age: "))
if age<6:
tkt_price=20
elif age>=6 and age<=9:
tkt_price=30
elif age>=10 and age<=17:
tkt_price=50
else:
tkt_price=100
total_amount=total_amount+(tkt_price-(0.05*tkt_price))
print("Total amount to pay after discount is : Rs.",total_amount)
Input:
Enter no.of members going to attend the fair: 6
Enter age: 12
Enter age: 7
Enter age: 15
Enter age: 27
Enter age: 32
Enter age: 17
Output:
Total amount to pay after discount is : Rs. 361.0
Learn more:
1. Predict the output of the following python program: num,sum=10,0 for i in range(1,num+2,2): if i % 3 == 0: continue sum = sum + i print(sum)
https://brainly.in/question/35223818
2. def find_max(nums):max_num float("-int") # smaller than all other numbersfor num in nums:if num > max_num:# (Fill in the missing line here)return...
https://brainly.in/question/35049689