How do I print out the total_cost?


#1

how do I print out the total_cost?

I am not recalling how to get the text to show up in the actual page after you hit run.

I have this for the previous 3 steps

cucumber_variable = "cucumbers"
cucumbers = 4
cucumber_price_variable = "price_per_cucumber"
price_per_cucumber = 3.25
total_variable = "total_cost"
total_cost = cucumbers * price_per_cucumber

FAQ: Learn Python - Python Syntax - Numbers
#2

You pretty much answered it in your question.

print total_cost

#3

O ok thank you that was quick ha

wasn’t sure if that was right


#4

can I ask why we write it without quotation marks here ?? although it is print code!!


#5

Hi @jozoven,

The quotes indicate that you want to print an arbitrary string. Without them, the interpreter looks for a variable named whatever you passed to print, then prints the variable’s value.

example_var = "lorem ipsum"

print("example_var") # "example_var"
print(example_var)   # "lorem ipsum"