,1. Basics
Basic syntax from the python programming language
Showing Output To User
the print function is used to display or print output
print("Content that you wanna print on screen")
Taking Input From User
the input function is used to take input from the user
var1 = input("Enter your name: ")
Empty List
This method allows you to create an empty list
my_list = []
Empty Dictionary
By putting two curly braces, you can create a blank dictionary
my_dict = {}
Range Function
range function returns a sequence of numbers, eg, numbers starting from 0 to n-1 for range(0, n)
range(int_value)
2. Comments
Comments are used to make the code more understandable for programmers, and they are not
executed by compiler or interpreter.
1/17
, Single line comment
#This is a single line comment
Multi-line comment
'''This is a
multi-line
comment'''
3. Escape Sequence
An escape sequence is a sequence of characters; it doesn't represent itself when used inside
string literal or character.
Newline
Newline Character
\n
Backslash
It adds a backslash
\\
Single Quote
It adds a single quotation mark
\'
Tab
It gives a tab space
\t
2/17