Sitemap
Maheshwarikolpur

Maheshwarikolpur

Python Syntax

1 min readNov 21, 2026

python syntax is a set of rules. It defines how python code should be written and structured.

example:

print(“Hello World”)

Output: Hello World

Important rules of python syntax

indentation : it is giving spaces at the beginning of the line.it defines blocks of code.

Case Sensitive: Python is a case sensitive. it supports capital and small letters.

Example:

name: “Maheshwari”

Name: “Python”

Comments: it is used to explain the code. it is using # symbol. Python does not execute comments.ignored by python engine. It supports single line comments. python does not support multiple line comments.

Example: print(“Maheshwari”) # this is a comment

Variable: it is a name. used to store a value in memory

Example:

name = “ Maheshwari”

age = 25

Get Maheshwarikolpur’s stories in your inbox

Join Medium for free to get updates from this writer.

Marks = 89

here name, age and marks are variables, Maheshwari, 25 and 89 are values.

Statements: set of instructions which python engine is execute.

there are 4 types

they are:

1) Single statement in single line: writing one statement in one line

a = 10

print(a)

2)multiple statement in a single line: writing more than one statement in a single line.

a = 10; b = 20; print(a+b)

3)single statement in a multiple lines: writing one statement across multiple lines. We can use paranthesis() to continue a statement across multiple lines.

total = (

20+30+15

)

print(total)

it is using two methods

  1. backslash (\)
  2. forward slash (/)

--

--