MyPyNotes
MyPyNotes
A PROGRAMMING LANGUAGE
A computer needs step – by – step instructions to complete a task. These instructions are called a
computer program when they are written in some programming language. But before they are
written in any programming language, these steps are written is simple English language. These
are called Algorithms. These instructions are written in a language which the computer
understands and this language is known as Programming language.
What is Python?
Python is a general purpose interactive high level programming language. Which is developed by
Guido Van Rossum during 1985-1990. Rossum named the language Python to honor British
comedy group Monty stands for
IDLE. It is typically used on windows. It has a multi – window text editor with syntax highlighting,
auto-completion, smart indent and other features.
Why Python?
Easy to learn and use as it has a simple structure and syntax.
Interactive language which uses an interpreter.
Portable and can be used on different platforms like Windows, Unix, Linux, Macintosh etc.
WELCOME TO PYTHON
Object – Oriented programming language and can also be integrated with other languages like C++,
Java etc.
FOSS(Free Open Source Software) language.
Faster than other languages.
Want to built a slick website? Develop a video game? Or may create an artificial intelligence? Python’s
got you covered and then some.
Python is HLL, with a ton of applications. It is seriously flexible and accessible, which makes it popular
with some of the world’s biggest and coolest organization- think Google, NASA, Disney, YouTube, Yahoo,
Dropbox….. Even the CIA.
Python shell can be used in two ways-
Interactive mode
Script mode
PYTHON FEATURES
Network Satellite Link
while As elif
global or with
class if for
Loop control statements: python has three control statements. These are used to change
the normal functioning of the loop.
Break statement Continue statement Pass
statement
DATA STRUCTURES
Almost every program used data. Organizing, managing and storing data is important as it
enables easier access and efficient modifications.
Data structures allow you to store and manage your data. Python has a number of built-in data
structures:
String
Lists
Dictionaries
Tuples
Sets
DATA STRUCTURES
There are a number of special characters that can be used in strings.
Escapes sequences: some characters cannot print directly in python. These character are
known as escaped characters. For example, Brian\’s mother
\n represents a new line.
\t represents a tab space… etc.
The in operator can be used to check if a string is part of another string.
Example:
X = ‘I have sound knowledge of python’
for ‘sound’ in X:
print(‘found’)
Note: the not in operator can be used to check if a string is not part of another string.
String can be added together by using + operator, called concatenation.
STRING MANIPULATION
String: A string can be seen as a sequcen of characters which are written within single , double
or tirple quotes. You have already read about them earlier. You can access the characters in a
string by putting the index after the string name in square brackets.
Example: name = ‘Python’
to access the character of name by using index.
name[0]
P
String can be added together (also called concatenation):
print(“spam”+’eggs’)
Strings can also be multiplied by integers. This produces a repeated version of the original
string.
print(“spam”*3)
String can’t be multiplied by other strings. Strings also can’t be multiplied by floats, even if the
floats are whole numbers.
STRING MANIPULATION
the len( ) function can be used to return the number of elements in a list.
Similar to strings, we can loop through the elements of a list using a loop:
X = [2,4,6,8]
for n in x:
print(n)
n will represent the current list item during each iteration.
SHORT CUTS KEYS IN PYTHON
SCRIPT MODE
F To run program
5
F Python documentation
1
Ctrl +
q To quite IDLE
short cuts of Py lib details visit https://www.python.org or
https://www.UniversalCodebox.com
THANK YOU