mercredi 21 octobre 2020

How to calculate the cost of 1 candy = $3 and 2 candy = $5 in python?

I am trying to figure out the cost of candy based on the user's input. When 1 candy = $3, 2 candies = $5, 5 candies = $13 and so forth. This what I got and would appericate the support.

print('Buy one candy for $3 and two candies for $5.')

candy = 0
user = float(input('How many candy do you want?'))
for i in candy():
  if user == 1:
     print(user*3)
 else user == 2:
     print(5)

print('You bought' + str{user} + 'You spent total of')

Aucun commentaire:

Enregistrer un commentaire