You are on page 1of 4

PYTHON MANUAL

Python is a interpreted, dynamically typed, general-purpose, object-oriented, programming


language.
Advantages
 Simple, clear syntax
 Named function arguments
 Heterogeneous data structures
 dictionary
 list
 Set
 Tuple
 Packages: large community of support
 Modular: great for larger projects (modules)
 Runs everywhere: Linux, Mac, and Windows
 Free and Open Source

Compilation Vs. Interpretation

C, C++, JAVA Python, Perl, MATLAB


What can we do with Python ?
 Scripting language
 Scientific Computations
 Data Analysis and Visualization
 Machine Learning and AI Applications
 Web Application Development
 IoT Application Development
 Game Programming
Python Comments
 Comments are lines that exist in computer programs that are ignored by compilers and
interpreters.
 In Python, we use the hash (#) symbol to start writing a comment.

#Print Hello world to console


print("Hello world")

Output:
Hello world

Multi Line Comments


• If we have comments that extend multiple lines, one way of doing it is to use hash (#)
in the beginning of each line.

#This is a long comment


#and it extends
#Multiple lines

• Another way of doing this is to use triple quotes, either ''' or """.

"""This is also a
perfect example of
multi-line comments"""

Python Keywords
• Keywords are the reserved words in python
• We can't use a keyword as variable name, function name or any other identifier
• Keywords are case sensitive

#Get all keywords in python 3.6
import keyword
print(keyword.kwlist)
print("Total number of keywords ", len(keyword.kwlist))
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif',
'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal',
'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
Total number of keywords 33

Python Statement
• put multiple statements in a single line using ;

Examples:
a = 10; b = 20; c = 30 #put multiple statements in a single line using ;
print(b)
Output :
20

Storage Locations
if True:
print (“Python Programming")
c = “Python Lab"

Write down regarding the import statement discussed in the lab.

You might also like