Basic Syntax

 

Python is case sensitive. Hence a variable with name yoyostudytonight is not same as yoYoStudytonight

In python, there is no command terminator, which means no semicolon ; or anything. So if you want to print something as output, all you have to do is

                 print ("Hello, World!"


In one line only a single executable statement should be written and the line change act as command terminator in python.

To write two separate executable statements in a single line, you should use a semicolon ; to separate the commands. For example,

print ("Hello, World!") ; print ("This is second line")

In python, you can use single quotes '', double quotes "" and even triple quotes ''' """ to represent string literals


Line Continuation: To write a code in multiline without confusing the python interpreter, is by using a backslash \ at the end of each line to explicitly denote line continuation. For example,

sum =  123 + \
       456 + \
       789

Expressions enclosed in ( )[ ] or { } brackets don't need a backward slash for line continuation. For example,

vowels = ['a', 'e', 'i',
          'o', 'u']

Code Indentation: This is the most important rule of python programming. generally curly brackets { } are used to define a code block, but python doesn't use brackets, then how does python knows where a particular code block ends. Well python used indentation for this