1. Home
  2. Python
  3. Python Tutorials
  4. Python – Basic Syntax

Python – Basic Syntax

Python Basic Syntax

The Python programming language syntax is a set of rules that define how a Python program will be written.

Like natural languages, a computer programming language includes a set of predefined words called keywords. A defined rule of use for each keyword is called syntax.

However, the syntax is something you will understand as you will see more and more programs and examples, but there are some things you should know by hand.

Python Syntax Rules:

  • Python is sensitive. Therefore, a variable named learnpython is not the same as Learn Python.
  • For the path specification, Python uses forward slashes. So, if you are working with a file, in the case of Windows OS, the default path to the file will have backward slashes, which you will need to convert to forward slash to work in your Python script.
  • Python has no command terminator such as no semicolon; or anything. So if you require to print something as an output, you only have to write it in a statement.
  • Python also allows you to write in single quotes ‘ ’, double quotes ” ” and triple quotes ‘ ‘ ‘ “””.
  • Python uses a backslash \ _ at the end of each line to explicitly denote line continuity and write a multiline code without confusing the interpreter.