Python Syntax

Valid Grammar for the language.

Rules which govern valid and invalid constructions.

Much of the rules are goverened by indentation indicating a code block.

Be consistent and include at least one space.

def test():
  print ("test")
  
  print("test2")
  
  string = "string"
  number = 10

test()

x = 1 + 2 \    #newline character makes indentation unimportant for the next line
    + 3

print(x)

Last updated