Home > other >  Pray that god will help, grateful
Pray that god will help, grateful

Time:10-04

X project:
Age group A=10-19
=20 to 29 age group B
Age group C=30-40

Y project:
Age group A=0-9
Age group B=10-17
Age group C=18 to 50,

Z project:
Age group A=0-17
=18 to 28 years old age group B
Age group C=29-50

Input user age (many people: 8 years old, the age of 12, 22, 33, 35, 36)

For users, several people in the A.B.C group

X project fee:
A set of registration fee=* 200
Group B fee=* 500
Application of group C=(+ 200) * 700

Y project fee:
A set of registration fee=* 500
Group B fee=* 100
Application of group C=(+ 500) * 300

Z project fee:
A set of registration fee=* 500
Group B fee=* 100
Application of group C=(+ 500) * 500

Pray for X Y Z how much is the total cost of the project, and the project total cost from low to high alignment.

Project has several hundred, set their ages, their registration fee is different also, this should be how to calculate

CodePudding user response:

To make the data list, contact relationship between the primary data

CodePudding user response:

reference 1st floor job 's-tears kindly reply:
the data list out first, the relationship between the primary data relations

Pray god get a simple source.
User_age=input (" please enter the age:)
All_age=range (0,75)
User_age_list=[int (User_age. The split () ", "[I]) for I in range (len (User_age. Split (","))))

Price=800 # to meet Price
Addi=100 # surcharge
Door_Car=1380 # car door
The Car=480 # meal
Cost Cost=1080 #
# # - section
Age_C=[int (All_age [0:12] [I]) for I in range (len (All_age [0:12]))]
Age_M=[int (All_age ["] [I]) for I in range (len (All_age ["]))]
Age_F1=[int (All_age [therefore] [I]) for I in range (len (All_age [therefore]))]
Age_F2=[int (All_age [66-69] [I]) for I in range (len (All_age [66-69]))]
Age_Z=[int (All_age [9] to survey [I]) for I in range (len (All_age [9] to survey))]

# # - car meal
User_age_All=[User_age for User_age in age_C if User_age User_age_list] in
Price_C=len (User_age_All) * Car
# # - car door meal
User_age_All=[User_age for User_age in age_M if User_age User_age_list] in
Price_M=len (User_age_All) * Door_Car
# # - additional
User_age_All=[User_age for User_age in age_F1 if User_age User_age_list] in
Num_F1=len (User_age_All)

User_age_All=[User_age for User_age in age_F2 if User_age User_age_list] in
Num_F2=len (User_age_All)

Normal # # -- -- --
User_age_All=[User_age for User_age in age_Z if User_age User_age_list] in
Num_Z=len (User_age_All)

Additional total number # # -
Num_F=int (Num_F1 + Num_F2)

Judging # # -- -- --
If Num_Z & gt; Num_F:
A=Price * Num_Z
B=(Price + Addi) * (Num_F1 + Num_F2)
Price_Z_F=a + b
Elif Num_Z==Num_F:
A=Price * Num_Z
B=(Price + Addi) * (Num_F1 + Num_F2)
Price_Z_F=a + b
Elif Num_Z & lt; Num_F:
A=Price * Num_Z
B=(Price + Addi) * Num_Z
C=Cost * (Num_F1 + Num_F2 - Num_Z)
Price_Z_F=a + b + c

# # - price
Price_Tota1=(Price_C + + Price_Z_F Price_M)