basic shoping app
hears the code for you all
gets your hand dirty in it!
apple_price = 2
# Assign 10 to the money variable
money = 10
input_count = input('How many apples do you want?: ')
count = int(input_count)
total_price = apple_price * count
print('You will buy ' + str(count) + ' apples')
print('The total price is ' + str(total_price) + ' dollars')
# Add control flow based on the comparison of money and total_price
if total_price< money:
left=money-total_price
print("You have bought "+str(count)+" apples")
print("You have "+str(left) + " dollars left")
elif total_price== money:
print("You have bought "+str(count) + " apples")
print("Your wallet is now empty")
else:
print("You do not have enough money")
print("You cannot buy that many apples")
Comments
Post a Comment