0

the print statment 2nd question while loops tut

hello! in the "print" line, why theres no need to put the variable x in the midle of the "", in other words, in the question is writen print(x) insted of print("x") and it works. but I tried to do with other statment's and doesn't works! thank's =)

23rd Dec 2016, 11:15 AM
Luis_Alves
3 Respostas
+ 3
>>> x=99 # x is an integer >>> print(x) 99 >>> print(99) # a number (variables cannot start with numbers) 99 >>> print("x") # string that happens to be letter x x >>> x="xX" # x is now a string of two letters >>> print(x) xX
23rd Dec 2016, 12:18 PM
Kirk Schafer
Kirk Schafer - avatar
+ 2
because x is a variable that you've already declared and "x" is a string
23rd Dec 2016, 11:22 AM
kallzo
kallzo - avatar
+ 2
x holds a value, while "x" is a value
23rd Dec 2016, 11:25 AM
kallzo
kallzo - avatar