What is the syntax for strings?

  • use single or double quotation marks to denote a string value
  • use * operator to multiply strings
  • use + to concatenate strings
  • use \n to print the rest of the string on a new line
  • place an r in front of your opening quotation mark to tell computer to ignore all special meanings of \
>>> "Hello World"
'Hello World'

>>> 'Hello World'
'Hello World'

>>> 'The person said "Hello World"'
'The person said "Hello World"'

>>> print("separate\nline")

>>> "word"*4

>>> firstStr = 'Tom'
>>> secondStr = 'Jerry'
>>> firstStr + " and " + secondStr
'Tom and Jerry'