IndexPythonJapaneseChainmailleLeather

Print Function

print() - display the contents of () as output.

  Print value as is:
   print(3)
    3

  Print string as is:
   print("Hello world")
    Hello World
   print('Hello world')
    Hello World

  Print string, preserving line breaks:
   print("""Hello
   world""")
    Hello
    world

  Print the value of an expression:
   print(3 + 4)
    7

  Print variable value:
   a = 1
   print(a)
    1

  Print value of expression containing variables:
   a = 1
   b = 2
   print(a + b)
    3

  Print multiple values:
   a = 1
   b = 2
   print("Hello", a, b, "world")
    Hello 1 2 world

HomeData TypesVariablesFunctionsEscape SequencesProgram Comments