How do I know when to include quotation marks when assigning values to variables?


In the Python Syntax lesson where we learn about Variable and Types of Data, all the values for the variable do not contain quotation marks. However, when learning about String Formatting with %, the variables contain quotation marks.

In Python Syntax, an example of a variable containing no quotation mark is:

a = True

In Strings & Console Output, this is an example of a variable that contains a value with a quotation mark.

name = "Mike"
print “Hello %s” % (name)


Variables have nothing to do with quotes, put quotes around text to define a string (a value representing text)


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.