In: Computer Science
For example:
Please write a program where you input a number of cantaloupes and Python tells you the total cost.
It is request to please don't leave without thumbs up I really need it so that I can provide quality answer to you hoping for good thank you!
I have answer this question according to the question in my language and provided the code below and adding comment so that you can understand well , hope you like and please don't dislike
If You have Any Query Regarding this please ask in comment section I will be there to solve all your query in comment section immediately hope you will like it
#please do thumbs up i really need it thankyou!
# enter the cantaloupes which you want
amt = int(input("Enter the cantaloupes you want : "))
# checking conditions and calculating cost
if(amt>0):
if amt<=20:
cost = amt*0.75
elif amt<=50:
cost=amt*0.70
elif amt<=100:
cost=0.65 * amt
else:
cost=0.60 * amt
print("Total cost is : $",cost)
else:
print("Invalid Number")
Output: