Suche senden
Hochladen
Lesson1 python an introduction
•
3 gefällt mir
•
872 views
Arulalan T
Folgen
Document under Creative Common
Weniger lesen
Mehr lesen
Bildung
Melden
Teilen
Melden
Teilen
1 von 99
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Python - An Introduction
Python - An Introduction
Eueung Mulyana
Python Tutorial
Python Tutorial
Eueung Mulyana
Python ppt
Python ppt
Rohit Verma
Introduction to advanced python
Introduction to advanced python
Charles-Axel Dein
Introduction to Python programming
Introduction to Python programming
Damian T. Gordon
Introduction to Python - Training for Kids
Introduction to Python - Training for Kids
Aimee Maree Forsstrom
Python for Linux System Administration
Python for Linux System Administration
vceder
An introduction to Python for absolute beginners
An introduction to Python for absolute beginners
Kálmán "KAMI" Szalai
Empfohlen
Python - An Introduction
Python - An Introduction
Eueung Mulyana
Python Tutorial
Python Tutorial
Eueung Mulyana
Python ppt
Python ppt
Rohit Verma
Introduction to advanced python
Introduction to advanced python
Charles-Axel Dein
Introduction to Python programming
Introduction to Python programming
Damian T. Gordon
Introduction to Python - Training for Kids
Introduction to Python - Training for Kids
Aimee Maree Forsstrom
Python for Linux System Administration
Python for Linux System Administration
vceder
An introduction to Python for absolute beginners
An introduction to Python for absolute beginners
Kálmán "KAMI" Szalai
OpenGurukul : Language : Python
OpenGurukul : Language : Python
Open Gurukul
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
SHAMJITH KM
Python
Python
Gagandeep Nanda
AmI 2017 - Python basics
AmI 2017 - Python basics
Luigi De Russis
Programming in Python
Programming in Python
Tiji Thomas
Python for Beginners(v1)
Python for Beginners(v1)
Panimalar Engineering College
Python basic
Python basic
Saifuddin Kaijar
Programming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
Let’s Learn Python An introduction to Python
Let’s Learn Python An introduction to Python
Jaganadh Gopinadhan
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Python made easy
Python made easy
Abhishek kumar
Python for-unix-and-linux-system-administration
Python for-unix-and-linux-system-administration
Victor Marcelino
python.ppt
python.ppt
shreyas_test_1234
Python in 30 minutes!
Python in 30 minutes!
Fariz Darari
Intro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
An Intro to Python in 30 minutes
An Intro to Python in 30 minutes
Sumit Raj
Pythonppt28 11-18
Pythonppt28 11-18
Saraswathi Murugan
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Open Gurukul
Functions
Functions
Marieswaran Ramasamy
programming with python ppt
programming with python ppt
Priyanka Pradhan
Introduction to python
Introduction to python
Yi-Fan Chu
Introduction to Python
Introduction to Python
Nowell Strite
Weitere ähnliche Inhalte
Was ist angesagt?
OpenGurukul : Language : Python
OpenGurukul : Language : Python
Open Gurukul
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
SHAMJITH KM
Python
Python
Gagandeep Nanda
AmI 2017 - Python basics
AmI 2017 - Python basics
Luigi De Russis
Programming in Python
Programming in Python
Tiji Thomas
Python for Beginners(v1)
Python for Beginners(v1)
Panimalar Engineering College
Python basic
Python basic
Saifuddin Kaijar
Programming Under Linux In Python
Programming Under Linux In Python
Marwan Osman
Let’s Learn Python An introduction to Python
Let’s Learn Python An introduction to Python
Jaganadh Gopinadhan
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Python made easy
Python made easy
Abhishek kumar
Python for-unix-and-linux-system-administration
Python for-unix-and-linux-system-administration
Victor Marcelino
python.ppt
python.ppt
shreyas_test_1234
Python in 30 minutes!
Python in 30 minutes!
Fariz Darari
Intro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
An Intro to Python in 30 minutes
An Intro to Python in 30 minutes
Sumit Raj
Pythonppt28 11-18
Pythonppt28 11-18
Saraswathi Murugan
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Open Gurukul
Functions
Functions
Marieswaran Ramasamy
programming with python ppt
programming with python ppt
Priyanka Pradhan
Was ist angesagt?
(20)
OpenGurukul : Language : Python
OpenGurukul : Language : Python
Python programming Workshop SITTTR - Kalamassery
Python programming Workshop SITTTR - Kalamassery
Python
Python
AmI 2017 - Python basics
AmI 2017 - Python basics
Programming in Python
Programming in Python
Python for Beginners(v1)
Python for Beginners(v1)
Python basic
Python basic
Programming Under Linux In Python
Programming Under Linux In Python
Let’s Learn Python An introduction to Python
Let’s Learn Python An introduction to Python
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python made easy
Python made easy
Python for-unix-and-linux-system-administration
Python for-unix-and-linux-system-administration
python.ppt
python.ppt
Python in 30 minutes!
Python in 30 minutes!
Intro to Python Programming Language
Intro to Python Programming Language
An Intro to Python in 30 minutes
An Intro to Python in 30 minutes
Pythonppt28 11-18
Pythonppt28 11-18
OpenGurukul : Language : PHP
OpenGurukul : Language : PHP
Functions
Functions
programming with python ppt
programming with python ppt
Andere mochten auch
Introduction to python
Introduction to python
Yi-Fan Chu
Introduction to Python
Introduction to Python
Nowell Strite
An Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm Review
Blue Elephant Consulting
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland
Python Introduction
Python Introduction
Mohammad Javad Beheshtian
Python - Lecture 1
Python - Lecture 1
Ravi Kiran Khareedi
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Matt Harrison
Introduction to Advanced Javascript
Introduction to Advanced Javascript
Collaboration Technologies
Meetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en python
Arthur Lutz
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)
Chia-Chi Chang
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Matt Harrison
Operator Overloading
Operator Overloading
Sardar Alam
Python for All
Python for All
Pragya Goyal
Installing Python on Mac
Installing Python on Mac
Wei-Wen Hsu
Python master class part 1
Python master class part 1
Chathuranga Bandara
Introduction to facebook java script sdk
Introduction to facebook java script sdk
Yi-Fan Chu
Introduction to Python - Running Notes
Introduction to Python - Running Notes
RajKumar Rampelli
Mastering python lesson2
Mastering python lesson2
Ruth Marvin
Introduction to facebook javascript sdk
Introduction to facebook javascript sdk
Yi-Fan Chu
Andere mochten auch
(20)
Introduction to python
Introduction to python
Introduction to Python
Introduction to Python
An Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm Review
Python Ireland Feb '11 Talks: Introduction to Python
Python Ireland Feb '11 Talks: Introduction to Python
Python Introduction
Python Introduction
Python - Lecture 1
Python - Lecture 1
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Analysis of Fatal Utah Avalanches with Python. From Scraping, Analysis, to In...
Introduction to Advanced Javascript
Introduction to Advanced Javascript
Meetup Python Nantes - les tests en python
Meetup Python Nantes - les tests en python
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to Java
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
Operator Overloading
Operator Overloading
Python for All
Python for All
Installing Python on Mac
Installing Python on Mac
Python master class part 1
Python master class part 1
Introduction to facebook java script sdk
Introduction to facebook java script sdk
Introduction to Python - Running Notes
Introduction to Python - Running Notes
Mastering python lesson2
Mastering python lesson2
Introduction to facebook javascript sdk
Introduction to facebook javascript sdk
Ähnlich wie Lesson1 python an introduction
Python An Intro
Python An Intro
Arulalan T
Python an-intro - odp
Python an-intro - odp
Arulalan T
python-an-introduction
python-an-introduction
Shrinivasan T
Becoming a Pythonist
Becoming a Pythonist
Raji Engg
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
DRVaibhavmeshram1
Python Novice to Ninja
Python Novice to Ninja
Al Sayed Gamal
Hands on Session on Python
Hands on Session on Python
Sumit Raj
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Matt Harrison
Python slide
Python slide
Kiattisak Anoochitarom
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
Utkarsh Sengar
Function in Python [Autosaved].ppt
Function in Python [Autosaved].ppt
GaganvirKaur
Python basics
Python basics
RANAALIMAJEEDRAJPUT
Python programming workshop session 1
Python programming workshop session 1
Abdul Haseeb
Python 101 1
Python 101 1
Iccha Sethi
Chapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptx
SovannDoeur
python beginner talk slide
python beginner talk slide
jonycse
Python for scientific computing
Python for scientific computing
Go Asgard
Python 101
Python 101
The Active Network
Charming python
Charming python
Abu Ashraf Masnun
Pres_python_talakhoury_26_09_2023.pdf
Pres_python_talakhoury_26_09_2023.pdf
RamziFeghali
Ähnlich wie Lesson1 python an introduction
(20)
Python An Intro
Python An Intro
Python an-intro - odp
Python an-intro - odp
python-an-introduction
python-an-introduction
Becoming a Pythonist
Becoming a Pythonist
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Introduction to Python 01-08-2023.pon by everyone else. . Hence, they must be...
Python Novice to Ninja
Python Novice to Ninja
Hands on Session on Python
Hands on Session on Python
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
Python slide
Python slide
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
Function in Python [Autosaved].ppt
Function in Python [Autosaved].ppt
Python basics
Python basics
Python programming workshop session 1
Python programming workshop session 1
Python 101 1
Python 101 1
Chapter 2 Python Language Basics, IPython.pptx
Chapter 2 Python Language Basics, IPython.pptx
python beginner talk slide
python beginner talk slide
Python for scientific computing
Python for scientific computing
Python 101
Python 101
Charming python
Charming python
Pres_python_talakhoury_26_09_2023.pdf
Pres_python_talakhoury_26_09_2023.pdf
Mehr von Arulalan T
wgrib2
wgrib2
Arulalan T
Climate Data Operators (CDO)
Climate Data Operators (CDO)
Arulalan T
CDAT - graphics - vcs - xmgrace - Introduction
CDAT - graphics - vcs - xmgrace - Introduction
Arulalan T
CDAT - cdms2, maskes, cdscan, cdutil, genutil - Introduction
CDAT - cdms2, maskes, cdscan, cdutil, genutil - Introduction
Arulalan T
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - Introduction
Arulalan T
Python an-intro-python-month-2013
Python an-intro-python-month-2013
Arulalan T
Python an-intro v2
Python an-intro v2
Arulalan T
Thermohaline Circulation & Climate Change
Thermohaline Circulation & Climate Change
Arulalan T
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
Pygrib documentation
Pygrib documentation
Arulalan T
Final review contour
Final review contour
Arulalan T
Contour Ilugc Demo Presentation
Contour Ilugc Demo Presentation
Arulalan T
Contour Ilugc Demo Presentation
Contour Ilugc Demo Presentation
Arulalan T
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Arulalan T
Nomography
Nomography
Arulalan T
matplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guide
Arulalan T
"contour.py" module
"contour.py" module
Arulalan T
contour analysis and visulaization documetation -1
contour analysis and visulaization documetation -1
Arulalan T
Automatic B Day Remainder Program
Automatic B Day Remainder Program
Arulalan T
Sms frame work using gnokii, ruby & csv - command line argument
Sms frame work using gnokii, ruby & csv - command line argument
Arulalan T
Mehr von Arulalan T
(20)
wgrib2
wgrib2
Climate Data Operators (CDO)
Climate Data Operators (CDO)
CDAT - graphics - vcs - xmgrace - Introduction
CDAT - graphics - vcs - xmgrace - Introduction
CDAT - cdms2, maskes, cdscan, cdutil, genutil - Introduction
CDAT - cdms2, maskes, cdscan, cdutil, genutil - Introduction
CDAT - cdms numpy arrays - Introduction
CDAT - cdms numpy arrays - Introduction
Python an-intro-python-month-2013
Python an-intro-python-month-2013
Python an-intro v2
Python an-intro v2
Thermohaline Circulation & Climate Change
Thermohaline Circulation & Climate Change
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Pygrib documentation
Pygrib documentation
Final review contour
Final review contour
Contour Ilugc Demo Presentation
Contour Ilugc Demo Presentation
Contour Ilugc Demo Presentation
Contour Ilugc Demo Presentation
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Edit/correct India Map In Cdat Documentation - With Edited World Map Data
Nomography
Nomography
matplotlib-installatin-interactive-contour-example-guide
matplotlib-installatin-interactive-contour-example-guide
"contour.py" module
"contour.py" module
contour analysis and visulaization documetation -1
contour analysis and visulaization documetation -1
Automatic B Day Remainder Program
Automatic B Day Remainder Program
Sms frame work using gnokii, ruby & csv - command line argument
Sms frame work using gnokii, ruby & csv - command line argument
Kürzlich hochgeladen
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
dhanalakshmis0310
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
PoojaSen20
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
MJDuyan
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
callscotland1987
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
Celine George
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
MaritesTamaniVerdade
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
TechSoup
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
pradhanghanshyam7136
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
AreebaZafar22
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
Poonam Aher Patil
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
Sherif Taha
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
christianmathematics
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
christianmathematics
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
VishalSingh1417
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
bronxfugly43
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
Celine George
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
Ramakrishna Reddy Bijjam
Kürzlich hochgeladen
(20)
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
psychiatric nursing HISTORY COLLECTION .docx
psychiatric nursing HISTORY COLLECTION .docx
Understanding Accommodations and Modifications
Understanding Accommodations and Modifications
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
Lesson1 python an introduction
1.
Python – An Introduction
Arulalan.T arulalant@gmail.com Centre for Atmospheric Sciences Indian Institute of Technology Delhi
2.
Python is a Programming Language
3.
There are so many Programming Languages.
Why Python ?
4.
5.
6.
Python is simple and beautiful
7.
Python is Easy to Learn
8.
Python is Free Open Source Software
9.
Can Do ●
Text Handling ● Games ● System Administration ● NLP ● GUI programming ● Web Applications ● ... ● Database Apps ● Scientific Applications
10.
H i s t
o r y
11.
Guido van Rossum Father of Python 1991
12.
Perl Java Python Ruby PHP 1987 1991 1993 1995
13.
What is Python?
14.
Python is...
A dynamic,open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
15.
Quick and Easy Intrepreted Scripting Language Variable declarations are unnecessary Variables are not typed Syntax is simple and consistent Memory management is automatic
16.
Object Oriented Programming Classes Methods Inheritance Modules etc.,
17.
Examples!
18.
19.
print “Hello World”
20.
No Semicolons !
21.
Indentation
22.
You have to follow the Indentation Correctly. Otherwise, Python will beat you !
23.
24.
Discipline Makes Good
25.
Variables colored_index_cards
26.
No Need to Declare Variable Types ! Python Knows Everything !
27.
value = 10 print value value = 100.50 print value value = “This is String” print value * 3
28.
Input
29.
name = raw_input(“What
is Your name?”) print "Hello" , name , "Welcome"
30.
Flow
31.
if score
>= 5000 : print “You win!” elif score <= 0 : print “Game over.” else: print “Current score:”,score print “Donen”
32.
Loop
33.
for i in range(1, 5): print i else: print 'The for loop is over'
34.
number = 23 while True : guess = int(raw_input('Enter an integer : ')) if guess == number : print 'Congratulations, you guessed it.' running = False elif guess < number : print 'No, it is a little higher than that.' else: print 'No, it is a little lower than that.' print 'Done'
35.
Array
36.
List = Array numbers = [ "zero", "one", "two", "three", "FOUR" ]
37.
List = Array numbers = [ "zero", "one", "two", "three", "FOUR" ] numbers[0] >>> zero numbers[4] numbers[1] >>> FOUR >>> FOUR numbers[2]
>>> three
38.
Multi Dimension List numbers = [ ["zero", "one"],["two", "three", "FOUR" ]] numbers[0] >>> ["zero", "one"] numbers[0][0] numbers[1][1] >>> zero >>> FOUR len(numbers)
>>> 2
39.
Sort List primes = [
11, 5, 7, 2, 13, 3 ]
40.
Sort List primes = [
11, 5, 7, 2, 13, 3 ] primes.sort()
41.
Sort List primes = [
11, 5, 7, 2, 13, 3 ] primes.sort() >>> [2, 3, 5, 7, 11, 13]
42.
Sort List names = [
"Shrini", "Bala", "Suresh", "Arul"] names.sort() >>> ["Arul", "Bala","Shrini","Suresh"] names.reverse() >>> ["Suresh","Shrini","Bala","Arul"]
43.
Mixed List names = [
"Shrini", 10, "Arul", 75.54] names[1]+10 >>> 20 names[2].upper() >>> ARUL
44.
Mixed List names = [
"Shrini", 10, "Arul", 75.54] names[1]+10 >>> 20 names[2].upper() >>> ARUL
45.
Append on List numbers = [ 1,3,5,7] numbers.append(9) >>> [1,3,5,7,9]
46.
Tuples immutable
47.
names = ('Arul','Dhastha','Raj') name.append('Selva') Error : Can not modify the tuple Tuple is immutable type
48.
String
49.
name = 'Arul' name[0] >>>'A' myname = 'Arul' + 'alan' >>> 'Arulalan'
50.
split name = 'This is python string' name.split(' ') >>>['This','is','python','string'] comma = 'Shrini,Arul,Suresh' comma.split(',') >>> ['Shrini','Arul','Suresh']
51.
join li = ['a','b','c','d'] s = '' new = s.join(li) >>> abcd new.split('') >>>['a','b','c','d']
52.
'small'.upper() >>>'SMALL' 'BIG'.lower() >>> 'big' 'mIxEd'.swapcase() >>>'MiXwD'
53.
Dictionary
54.
menu = {
“idly” : 2.50, “dosai” : 10.00, “coffee” : 5.00, “ice_cream” : 5.00, 100 : “Hundred” } menu[“idly”] 2.50 menu[100] Hundred
55.
Function
56.
def sayHello(): print 'Hello World!' # block belonging of fn # End of function sayHello() # call the function
57.
def printMax(a, b): if a > b: print a, 'is maximum' else: print b, 'is maximum' printMax(3, 4)
58.
Using in built Modules
59.
#!/usr/bin/python # Filename: using_sys.py import time print 'The sleep started' time.sleep(3) print 'The sleep finished'
60.
#!/usr/bin/python import os os.listdir('/home/arulalan') os.walk('/home/arulalan')
61.
Making Our Own Modules
62.
#!/usr/bin/python # Filename: mymodule.py def sayhi(): print “Hi, this is mymodule speaking.” version = '0.1' # End of mymodule.py
63.
#!/usr/bin/python # Filename: mymodule_demo.py import mymodule mymodule.sayhi() print 'Version', mymodule.version
64.
#!/usr/bin/python # Filename: mymodule_demo2.py from mymodule import sayhi, version # Alternative: # from mymodule import * sayhi() print 'Version', version
65.
Class
66.
Classes class Person: pass # An empty block p = Person() print p
67.
Classes class Person: def sayHi(self): print 'Hello, how are you?' p = Person() p.sayHi()
68.
Classes class Person: def __init__(self, name):
#like contstructor self.name = name def sayHi(self): print 'Hello, my name is', self.name p = Person('Arulalan.T') p.sayHi()
69.
Classes Inheritance
70.
Classes class A: def hello(self):
print ' I am super class ' class B(A): def bye(self): print ' I am sub class ' p = B() p.hello() p.bye()
71.
Classes class A:
Var = 10 def __init__(self): self.public = 100 self._protected_ = 'protected' self.__private__ = 'private' Class B(A): pass p = B() p.__protected__
72.
File Handling
73.
File Writing
74.
poem = ''' Programming is fun When the work is done if you wanna make your work also fun: use Python! ''' f = file('poem.txt', 'w') # open for 'w'riting f.write(poem) # write text to file f.close()
75.
File Reading
76.
f= file('poem.txt','r') for line in f.readlines():
print line f.close()
77.
Database Intergration
78.
import psycopg2 conn = psycopg2.connect(" dbname='pg_database' user='dbuser' host='localhost' password='dbpass' ") cur = conn.cursor() cur.execute("""SELECT * from pg_table""") rows = cur.fetchall() print rows cur.close() conn.close()
79.
import psycopg2 conn = psycopg2.connect(" dbname='pg_database' user='dbuser' host='localhost' password='dbpass' ") cur = conn.cursor() cur.execute("'insert into pg_table values(1,'python')"') conn.commit() cur.close() conn.close()
80.
THE END of code :)
81.
How to learn ?
82.
Python – Shell
Interactive Python ● ● Instance Responce ● Learn as you type
83.
bpython ipython
} teach you very easily
84.
Python can communicate With Other Languages
85.
C + Python
86.
87.
Java + Python
88.
89.
GUI With Python
90.
91.
Glade + Python + GTK = GUI APP
92.
GLADE
93.
Using Glade + Python
94.
Web Web
95.
Web Frame Work in Python
Jetzt herunterladen