Welcome to Python /Python-3.0 programing language
Python language
Introduction: Python is a basic language and also freely available is an example of FLOSS (Free/Libre and open source software).
- Different type of commend used for python (“”) close syntax code.
- (\n) this code is used for break line character and multiple times used this character such as (\n\n\n\n\n\n) more space between two brake line characters
- Download python version
Is Python a “Scripting Language”?
Python is a general-purpose programming language that is often applied in scripting roles. It is commonly defined as an object-oriented scripting language—a definition that blends support for OOP with an overall orientation toward scripting roles. In fact, people often use the word “script” instead of “program” to describe a Python code file.
Who Uses Python Today?
- Google makes extensive use of Python in its web search systems and employs Python’s creator.
- The YouTube video sharing service is largely written in Python.
- The popular BitTorrent peer-to-peer file sharing system is a Python program.
- Google’s popular App Engine web development framework uses Python as its application language.
- EVE Online, a Massively Multiplayer Online Game (MMOG), makes extensive use of Python.
- Maya, a powerful integrated 3D modeling and animation system, provides a Python scripting API.
- ESRI uses Python as an end-user customization tool for its popular GIS mapping products.
- iRobot uses Python to develop commercial robotic devices.
- The One Laptop Per Child (OLPC) project builds its user interface and activity model in Python.
- The IronPort email server product uses more than 1 million lines of Python code to do its job.
Function Basics
Functions are the most basic program structure Python provides for maximizing code reuse and minimizing code redundancy.
Statement | Examples |
Calls | myfunc(‘spam’, ‘eggs’, meat=ham) |
def,return | def adder(a, b=1, *c): return a + b + c[0] |
global | def changer(): global x; x = ‘new’ |
nonlocal | def changer(): nonlocal x; x = ‘new’ |
yield | def squares(x): for i in range(x): yield i ** 2 |
lambda | funcs = [lambda x: x**2, lambda x: x*3] |

- Python is a case sensitive programming language.
- An identifier starts with a letter A to Z or a to z or underscore (_) followed by zero or more letters, underscore and digits (0 to 9)
- Python does not allow special character such as @,$ and % within identifier.



Operator: Operators are the constructs that can manipulate the value of the operands.
Consider the expression 2+3= 5, hereby 2 and 3 operands and + is called operator.
- Arithmetic , comparison, Assignment, logical, bitwise, membership, identity
- Arithmetic operator: Modulus = a%b, Exponent = a**b, floor division = a//b,
- Assignment operator: assign value from right to left
a= a+b = a+=b all values are same
(Note: these are shorthand notation)
- Comparison operator: Equal to a==b, Not equal to a! =b, greater than a>b greater than equal
to a>=b same for less than. - Logical operator: AND operator = a and b (slow the maximum value)
OR operator = a or b ( slow the minimum value)
NOT operator= not a (Returns true if a is true, false otherwise)
- Bitwise operator: only based on mathematical value such as.


FOR LOOP: ‘for’ loop is a python loop that repeats a group of statements a specified number of times. The loop provides a syntax where the following information is provided:
- Boolean condition.
- The initial value of the counting variable.
- Incrimination of counting variable.
For <variable > in <range>:
Stmt1
Stmt2
……..
Stent
Nested loops:
A nested loop basically means a loop inside a loop. It can be a for loop inside a while loop and vice-versa. It can also be a while loop inside a while loop or a loop inside a for a loop.

Example: let’s code a program in python that effectively simulates a bank ATM
Command-line parameters:
- It is possible to pass argument to python programs when they are executed
- The brackets which follow main are used for this purpose
- . argv refers to the number of argument passed , and argv[] is a pointer array which point to each argument which is passed to main
- The python sys module provides access to any command- line argument via the sys.argv. this serves two purposes:
Sys.argv is the list of command-line arguments
Len (sys.argv) is the number of command-line arguments
Opening and closing the files






Why Do People Use Python?
the choice of development tools is sometimes based on unique constraints or personal preference.
- Software quality: Python’s focus on readability, coherence, and software quality in general sets it apart from other tools in the scripting world Python has deep support for more advanced software reuse mechanisms, such as object-oriented programming (OOP).
- Developer productivity: Python boosts developer productivity many times beyond compiled or statically typed languages such as C, C++, and Java. Python code is typically one-third to one-fifth the size of equivalent C++ or Java code.
- Program portability: Most Python programs run unchanged on all major computer platforms. Porting Python code between Linux and Windows, for example.
- Python’s third-party domain offers toolsfor website construction, numeric programming, serial port access, game development, and much more. The NumPy extension, for instance, has been describedas a free and more powerful equivalent to the Matlab numeric programmingsystem.
Module Coding Basics
To define a module, simply use your text editor to type some Python code into a text file, and save it with a “.py” extension; any such file is automatically considered a Python module
if you type the following def into a file called module1.py and import it
def printer(x): | # Module attribute |
print(x) |
The import Statement
In the first example,
which references the
module object after the file is loaded:
>>> import module1 # Get module as a whole
>>> module1.printer(‘Hello world!’) # Qualify to get names
Hello world!
What is the main point of OOP in Python?
OOP is about code reuse—you factor code to minimize redundancy and program by customizing what already exists instead of changing code in-place or starting from scratch.

Python’s Keywords
and | Continue | except | global | lambda |
pass | while | as | def | False |
if | None | raise | with | assert |
del | finally | impoart | nonlocal | return |
yield | break | elif | for | in |
not | Ture | class | else | from |
is | or | try | – | – |
Binary to Decimal
Here’s a binary number 01101001, let’s convert it to a decimal number.
( 01101001 )2 = 0 x 27 + 1 x 26 + 1 x 25 + 0 x 24+ 1 x 23 + 0 x 22 + 0 x 21 + 1
x 20
( 01101001 )2 = 0 + 64 + 32 + 0 + 8 + 0 + 0 + 1
( 01101001 )2 = ( 105 )10
Decimal to Binary
An interesting thing to note here is that ( 01101001 )2 and ( 1101001 )2represent the same decimal number ( 105 )10. It means that just like the decimal number system, leading zeros can be ignored in the binary number system.

Book Pdf Download
Download python book | Basic python 4-edition |
python beginner | Python workout |
Python professional | Python short Notes |