Why didn’t my product display on the screen?


#1

Question

I’ve defined the product as asked and assigned it a value, but it isn’t displayed to the terminal. Why is this?

Answer

Computers must be told what to do at every step of the way. If you don’t tell it to print something to the screen it has no way of knowing you wanted product displayed to you. If you want, you could add print product to the next line to see the result of your multiplication.

Also! If at any time you do see something that you didn’t explicitly print, it may be because of tests being run by Codecademy that would not normally appear outside of our environment here.


FAQ: Learn Python - Python Syntax - Arithmetic
#2

I tried adding print commands before but it only displays ‘product’ (or the name of the other variable) in the terminal, also after refreshing, why is this?


#3

Have you tried writing without using quotations? just put print(x) instead of print(“x”).

I believe that when you put quotes, it uses the content as a string or integer, rather than an item in your code, in this case, the output of the variable.

I could be wrong, but I think that’s it!


#4

I Have tried with and without quotations but maybe I should have added the parenthesis to name the variable product?
Thanks for helping me out @ekulbyrnes
And now I concluded that I only needed to remove the parenthesises and quotations


#5

I had the same question and figured it out. To display the answer to the arithmetic problem 12 x 8 I used this code to get the answer to display. Since it knows that the math is multiplication you don’t need to have the word product anywhere in the code anymore.

Code: print (12 * 8)
Displayed Result: 96


#7

Thank you I tried and it worked