Introduction:
What is programming: It is a way of communicating with the machine using binary code.
What is interpreter: An interpreter translates and executes code step-by-step instead of converting the whole program into machine code at once.
What is compiler: It is a program that translates high level source code into machine code (binary).
How python files run at backend: After entering as python3 filename, it will first convert into byte code.
python.py → bytecode (.pyc) → executed by PVM
This will run on every server.
Python is both compiler and interpreted language.
nano linux commands:
- pwd - print working directory (to check where the file is located).
- mkdir - make directory
- ls - list
- cd - change directory
- rmdir - remove directory
import this - displays the Zen of Python
quit() - to get exit from the program.
Indentation - It is the spaces (or tabs) given at the beginning of the line of code.
Swapping of two variables:
a = 17
b = 5
a = a+b
b = a-b
a = a-b
print(a,b)
Output:
5 17
This can also be done using tuple method.
a = 10
b = 5
a,b = b,a
print(a,b)
Output:
5 10

Top comments (0)