I just started with learning coding using pycharm. So everything is new for me. I have to write couple of programs which are simple and easy, out of which i have already written and just stuck with this one.
Problem: Design a program that will calculate the total cost of equipment for the 3 new cricket players representing JCU Brisbane Sports Club. The new items are as follows: - Each new player gets knee pads and batting gloves. - The user will be asked the t-shirt size for each new player and based on this the t-shirt price will be added to the total. - In addition, the team also gets 3 new cricket balls and 5 new bats.
Cricket balls cost $20 each, bats $45, knee pads $70 and $130 for a pair of batting gloves. Tshirt sizes are S ($45), M ($55), L ($65) and XL ($75).
The program should return the total cost of the equipment.
What i am unable to do is how to define value for each specific size for each specific player. I am new and stuck. If anyone could help please.
This what i have done so far:
# practise for coding challenge
psize = input("enter the size of the player1(s/m/l/xl): ")
#psize2 = input("enter the size of the player:")
cricBall = 20
cricBat = 45
kPad = 70
batGlove = 130
tsmall = 45
tmed = 55
tlar = 65
txl = 75
if psize == "s":
total = (3 * kPad) + (3 * batGlove) + 45 + (3 * cricBall) + (5 * cricBat)
print("The total cost of equipment is:", total)
if psize == "m":
total = (3 * kPad) + (3 * batGlove) + 55 + (3 * cricBall) + (5 * cricBat)
print("The total cost of equipment is:", total)
if psize == "l":
total = (3 * kPad) + (3 * batGlove) + 65 + (3 * cricBall) + (5 * cricBat)
print("The total cost of equipment is:", total)
if psize == "xl":
total = (3 * kPad) + (3 * batGlove) + 75 + (3 * cricBall) + (5 * cricBat)
print("The total cost of equipment is:", total)