Python tutorial 2

Python Basics



• Always use .py as extention

First Command of Python in VS code
# Make a python file 
# Write print, bracket and double comma in it then text you want to write.
#e.g [print ("Hello")]   ([] long bracket not to be written.)
# Save the file 
#Press Run Button on top right area of window
# File will run in prompt 

Commenting out in Python
# To comment out in python write '# ' as first character of line 
# Commenting out means that when your command runs than python interpreter will skip the line. 
    It is usually used as a remark for the code 

 Assigning Variables in python
 # Assigning variable in python is same as letting a variable in maths.
# To assign a variable write a variable (A variable can be a letter abc...) write equal to a 'number' or a 'word' or another variable
# E.g    [a = 2 ][b = 'python'][ a =b][ c = 10.9]
# Write print, bracket, variable in it
# E.g print(a)  {dont write print("a")}

Arthrmatic Operation in Python
Operator            Function                         
+                          Addtion[ 1+2 ]
-                           Substraction[ 1-2 ]
/                          Quotient with Decimals[10/2]
//                         Quotient without                                                   Decimals[10//2]
%                          Remainder[11%2]
**                         Raise to power [10**2]

      
E.g 
# print(1+2)
    3
# a = 1
    b = 2
    print (a+b)
      3



For Refence visit 'Programmer AAA' Youtube Channel

By Arnav Saxena