52.6k views
17 votes
Write a program that asks the user how many freebees they would like to buy then prints out the total cost

User Rosena
by
3.4k points

1 Answer

6 votes

Answer:

Step-by-step explanation:

The following code is written in Python and does exactly what is requested by the question. It asks the user how many freebes they would like using an input method, saves that value to a variable called number_of_freebies. Then it multiplies that variable by the cost of each feebie (assuming its $2 each) to get the total cost. Finally, printing out the total cost.

number_of_freebies = input("how many freebies would you like to buy? ")

cost_of_freebie = 2

total_cost = number_of_freebies * cost_of_freebie

print(total_cost)

User Thiha Zaw
by
3.5k points