Computer Science, asked by vamsi4662, 1 month ago

TASK:

Write a Python program to calculate the total amount a family of N members should pay to attend the fair.

The program should:

1. Accept the no. of members in the family (say, N) from the user.

2. 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.​​

Answers

Answered by poojan
11

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

Similar questions