0001 Python Introduction
1.
Python is a programming language.
It can be used on a server to create web applications.
2.
print("Hello world")
Output:
Hello World
3.
How to find the python version:
i. from cmd.exe
>python --version
ii. from an editor
import sys
print(sys.version)
4.
Python can be run as a command line itself.
Type the following on the Windows, Mac or Linux command line:
C:\Users\sathi>python
or
C:\Users\sathi>py
From there you can write any python.
Whenever you are done in the python command line, you can simply type the following to quit the python command line interface:
exit()
5.
Python syntax can be executed by writing directly in the Command Line.
Or by creating a python file on the server, using the .py file extension, and running it in the Command Line.
6.
Q 1.
What is the difference between global and local scope?
A variable created in the main body of the Python code is a global variable and belongs to the global scope. Global variables are available from within any scope, global and local.
A variable created inside a function belongs to the local scope of that function, and can only be used inside that function.

Comments
Post a Comment