Print comment and Strings

How a print comment should work, especially with string type.

print

  • “print” with small letter “p”

string

  • A string: when you put either “ (double-quotes) or ‘ (single-quotes) around the text.

  • To formatted variables in the string, use a % (percent) character, followed by the variable. (r,s,d,)

  • To print multiple variables, you need to put them inside ( ) (parenthesis) separated by , (commas).

  • Zhe: To formatted variables in the string, use a {} character, then call the variables as .format(variables)

      a = 10
      print "I said {}".format(a)
    
March 28, 2017