File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ apple_price = 2
2
+ # Assign 10 to the money variable
3
+ money = 10
4
+
5
+ input_count = input ('How many apples do you want?: ' )
6
+ count = int (input_count )
7
+ total_price = apple_price * count
8
+
9
+ print ('You will buy ' + str (count ) + ' apples' )
10
+ print ('The total price is ' + str (total_price ) + ' dollars' )
11
+
12
+ left_money = money - total_price
13
+ # Add control flow based on the comparison of money and total_price
14
+ if money > total_price :
15
+ print ("You have bought " + str (count ) + " apples" )
16
+ print ("You have " + str (left_money ) + " dollars left" )
17
+
18
+ elif money == total_price :
19
+ print ("You have bought " + str (count ) + " apples" )
20
+ print ("Your wallet is now empty" )
21
+
22
+ else :
23
+ print ("You do not have enough money" )
24
+ print ("You cannot buy that many apples" )
You can’t perform that action at this time.
0 commit comments