Enviar búsqueda
Cargar
Python Introduction - An Easy Programming Language to Learn
•
8 recomendaciones
•
12,830 vistas
Título mejorado por IA
Arulalan T
Seguir
Tecnología
Educación
Denunciar
Compartir
Denunciar
Compartir
1 de 109
Descargar ahora
Descargar para leer sin conexión
Recomendados
Python - An Introduction
Python - An Introduction
Swarit Wadhe
Python Programming ppt
Python Programming ppt
ismailmrribi
Intro to Python
Intro to Python
primeteacher32
Python ppt
Python ppt
Rachit Bhargava
Python basic
Python basic
Saifuddin Kaijar
Python basics
Python basics
RANAALIMAJEEDRAJPUT
Python quick guide1
Python quick guide1
Kanchilug
Intro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
Recomendados
Python - An Introduction
Python - An Introduction
Swarit Wadhe
Python Programming ppt
Python Programming ppt
ismailmrribi
Intro to Python
Intro to Python
primeteacher32
Python ppt
Python ppt
Rachit Bhargava
Python basic
Python basic
Saifuddin Kaijar
Python basics
Python basics
RANAALIMAJEEDRAJPUT
Python quick guide1
Python quick guide1
Kanchilug
Intro to Python Programming Language
Intro to Python Programming Language
Dipankar Achinta
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Python Tutorial Part 2
Python Tutorial Part 2
Haitham El-Ghareeb
Introduction to-python
Introduction to-python
Aakashdata
Python course syllabus
Python course syllabus
Sugantha T
Beginning Python Programming
Beginning Python Programming
St. Petersburg College
Jumping statements
Jumping statements
Suneel Dogra
Phython Programming Language
Phython Programming Language
R.h. Himel
Python ppt
Python ppt
Mohita Pandey
NUMPY
NUMPY
SharmilaChidaravalli
Introduction to Python
Introduction to Python
amiable_indian
Python programming
Python programming
Keshav Gupta
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
Full Python in 20 slides
Full Python in 20 slides
rfojdar
Introduction to C Programming - I
Introduction to C Programming - I
vampugani
Begin with Python
Begin with Python
Narong Intiruk
Python programming
Python programming
Prof. Dr. K. Adisesha
Python
Python
Aashish Jain
Presentation on C++ Programming Language
Presentation on C++ Programming Language
satvirsandhu9
Python: the Project, the Language and the Style
Python: the Project, the Language and the Style
Juan-Manuel Gimeno
Introduction to Python Basics Programming
Introduction to Python Basics Programming
Collaboration Technologies
Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)
iloveallahsomuch
Object oriented programming with python
Object oriented programming with python
Arslan Arshad
Más contenido relacionado
La actualidad más candente
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Paige Bailey
Python Tutorial Part 2
Python Tutorial Part 2
Haitham El-Ghareeb
Introduction to-python
Introduction to-python
Aakashdata
Python course syllabus
Python course syllabus
Sugantha T
Beginning Python Programming
Beginning Python Programming
St. Petersburg College
Jumping statements
Jumping statements
Suneel Dogra
Phython Programming Language
Phython Programming Language
R.h. Himel
Python ppt
Python ppt
Mohita Pandey
NUMPY
NUMPY
SharmilaChidaravalli
Introduction to Python
Introduction to Python
amiable_indian
Python programming
Python programming
Keshav Gupta
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
Pedro Rodrigues
Full Python in 20 slides
Full Python in 20 slides
rfojdar
Introduction to C Programming - I
Introduction to C Programming - I
vampugani
Begin with Python
Begin with Python
Narong Intiruk
Python programming
Python programming
Prof. Dr. K. Adisesha
Python
Python
Aashish Jain
Presentation on C++ Programming Language
Presentation on C++ Programming Language
satvirsandhu9
Python: the Project, the Language and the Style
Python: the Project, the Language and the Style
Juan-Manuel Gimeno
Introduction to Python Basics Programming
Introduction to Python Basics Programming
Collaboration Technologies
La actualidad más candente
(20)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python Tutorial Part 2
Python Tutorial Part 2
Introduction to-python
Introduction to-python
Python course syllabus
Python course syllabus
Beginning Python Programming
Beginning Python Programming
Jumping statements
Jumping statements
Phython Programming Language
Phython Programming Language
Python ppt
Python ppt
NUMPY
NUMPY
Introduction to Python
Introduction to Python
Python programming
Python programming
Introduction to the basics of Python programming (part 1)
Introduction to the basics of Python programming (part 1)
Full Python in 20 slides
Full Python in 20 slides
Introduction to C Programming - I
Introduction to C Programming - I
Begin with Python
Begin with Python
Python programming
Python programming
Python
Python
Presentation on C++ Programming Language
Presentation on C++ Programming Language
Python: the Project, the Language and the Style
Python: the Project, the Language and the Style
Introduction to Python Basics Programming
Introduction to Python Basics Programming
Destacado
Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)
iloveallahsomuch
Object oriented programming with python
Object oriented programming with python
Arslan Arshad
Advance OOP concepts in Python
Advance OOP concepts in Python
Sujith Kumar
Python: Basic Inheritance
Python: Basic Inheritance
Damian T. Gordon
Python: Multiple Inheritance
Python: Multiple Inheritance
Damian T. Gordon
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Sujith Kumar
Destacado
(6)
Python object oriented programming (lab2) (2)
Python object oriented programming (lab2) (2)
Object oriented programming with python
Object oriented programming with python
Advance OOP concepts in Python
Advance OOP concepts in Python
Python: Basic Inheritance
Python: Basic Inheritance
Python: Multiple Inheritance
Python: Multiple Inheritance
Basics of Object Oriented Programming in Python
Basics of Object Oriented Programming in Python
Similar a Python Introduction - An Easy Programming Language to Learn
Python an-intro youtube-livestream-day1
Python an-intro youtube-livestream-day1
MAHALAKSHMI P
Why should you learn to python programming?
Why should you learn to python programming?
sakshichaudhary58
Python Programming Part 1.pdf
Python Programming Part 1.pdf
percivalfernandez2
Python Programming Part 1.pdf
Python Programming Part 1.pdf
percivalfernandez2
Python Programming Part 1.pdf
Python Programming Part 1.pdf
percivalfernandez2
Python basics
Python basics
ssuser4e32df
Python Programming Introduction For Students
Python Programming Introduction For Students
ShaunakBale1
Features of Python.pdf
Features of Python.pdf
SudhanshiBakre1
Python
Python
Learnbay Datascience
637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx
Arjun123Bagri
Python Programming
Python Programming
shahid sultan
Machine learning session 1
Machine learning session 1
NirsandhG
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
HaythamBarakeh1
Introduction to python
Introduction to python
AnirudhaGaikwad4
Govind.ppt.pptx
Govind.ppt.pptx
ShivKaushik8
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Gnanesh12
Python Training in Chandigarh
Python Training in Chandigarh
Excellence Technology
Beginning python programming
Beginning python programming
kanteshraj
Introduction to python
Introduction to python
Soba Arjun
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Manohar k
Similar a Python Introduction - An Easy Programming Language to Learn
(20)
Python an-intro youtube-livestream-day1
Python an-intro youtube-livestream-day1
Why should you learn to python programming?
Why should you learn to python programming?
Python Programming Part 1.pdf
Python Programming Part 1.pdf
Python Programming Part 1.pdf
Python Programming Part 1.pdf
Python Programming Part 1.pdf
Python Programming Part 1.pdf
Python basics
Python basics
Python Programming Introduction For Students
Python Programming Introduction For Students
Features of Python.pdf
Features of Python.pdf
Python
Python
637b4894085c4_ppt.pptx
637b4894085c4_ppt.pptx
Python Programming
Python Programming
Machine learning session 1
Machine learning session 1
Python_Introduction&DataType.pptx
Python_Introduction&DataType.pptx
Introduction to python
Introduction to python
Govind.ppt.pptx
Govind.ppt.pptx
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
Python Training in Chandigarh
Python Training in Chandigarh
Beginning python programming
Beginning python programming
Introduction to python
Introduction to python
Python Programming and ApplicationsUnit-1.docx
Python Programming and ApplicationsUnit-1.docx
Más de 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
Thermohaline Circulation & Climate Change
Thermohaline Circulation & Climate Change
Arulalan T
Python an-intro - odp
Python an-intro - odp
Arulalan T
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
Pygrib documentation
Pygrib documentation
Arulalan T
Lesson1 python an introduction
Lesson1 python an introduction
Arulalan T
Python An Intro
Python An Intro
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
Más de 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
Thermohaline Circulation & Climate Change
Thermohaline Circulation & Climate Change
Python an-intro - odp
Python an-intro - odp
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Pygrib documentation
Pygrib documentation
Lesson1 python an introduction
Lesson1 python an introduction
Python An Intro
Python An Intro
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
Último
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
wesley chun
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Igalia
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
UK Journal
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
The Digital Insurer
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
Puma Security, LLC
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Safe Software
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
Maria Levchenko
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Delhi Call girls
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Drew Madelung
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Igalia
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
Khem
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Rafal Los
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Miguel Araújo
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
The Digital Insurer
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Neo4j
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
debabhi2
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Radu Cotescu
Último
(20)
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
Python Introduction - An Easy Programming Language to Learn
1.
Python – An Introduction Arulalan.T arulalant@gmail.com Centre for Atmospheric Science 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 ●
System Administration ● GUI programming ● Web Applications ● Database Apps ● Scientific Applications ● Games ● NLP ● ...
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.
Variables colored_index_cards
22.
No Need to Declare Variable Types ! Python Knows Everything !
23.
value = 10 print value value = 100.50 print value value = “This is String ” print value * 3 # Oh !
24.
Input
25.
name = raw_input(“What
is Your name?”) print "Hello" , name , "Welcome"
26.
Indentation
27.
You have to follow the Indentation Correctly. Otherwise, Python will beat you !
28.
29.
Discipline Makes Good
30.
Flow
31.
if score >=
5000 : print “You win!” elif score <= 0 : print “You lose!” 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.
Q) Print Multiplication Table of user defined number upto N times. Get both number & N from the User Hint : Use may use For / While Loop
35.
Soln) Print Multiplication Table of user defined number upto N times. no = int(raw_input(“Enter number ”)) N = int(raw_input(“Enter N value ”)) for i in range(1, N + 1): print “%d x %d = %d” % (i, no, i*no)
36.
number = 23 running = True while running : 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'
37.
Q) What is the core purpose of while loop ?
38.
Q) What is the core purpose of while loop ? Ans) when the loop has to stop w.r.t certain condition/s. So the no of loops in “while loop” is dynamic / undefined one.
39.
Lets have some break
40.
Lets continue
41.
Array
42.
List = Array numbers = [ "zero", "one", "two", "three", "FOUR" ]
43.
List = Array numbers = [ "zero", "one", "two", "three", "FOUR" ] numbers[0] >>> zero numbers[4] numbers[1] >>> FOUR >>> FOUR numbers[2] >>> three
44.
Multi Dimension List numbers = [ ["zero", "one"], ["two", "three", "FOUR" ] ] numbers[0] >>> ["zero", "one"] numbers[0][0] numbers[1][1] >>> zero >>> FOUR len(numbers) >>> 2
45.
Sort List primes = [
11, 5, 7, 2, 13, 3 ]
46.
Sort List primes = [
11, 5, 7, 2, 13, 3 ] primes.sort()
47.
Sort List primes = [
11, 5, 7, 2, 13, 3 ] primes.sort() >>> [2, 3, 5, 7, 11, 13]
48.
Sort List names = [
"Shrini", "Bala", "Suresh", "Arul"] names.sort() >>> ["Arul", "Bala","Shrini","Suresh"] names.reverse() >>> ["Suresh","Shrini","Bala","Arul"]
49.
Mixed List names = [
"Shrini", 10, "Arul", 75.54] names[1]+10 >>> 20 names[2].upper() >>> ARUL
50.
Append on List numbers = [ 1,3,5,7] numbers.append(9) >>> [1,3,5,7,9]
51.
Tuples immutable
52.
names = ('Arul','Dhastha','Raj') name.append('Selva') Error : Can not modify the tuple Tuple is immutable type
53.
String
54.
name = 'Arul' name[0] >>>'A' myname = 'Arul' + 'alan' >>> 'Arulalan'
55.
name = 'This is python string' name.split(' ') >>> ['This', 'is', 'python', 'string'] comma = 'Shrini,Arul,Suresh' comma.split(',') >>> ['Shrini', 'Arul', 'Suresh'] split
56.
li = ['a','b','c','d'] new = ''.join(li) >>> 'abcd' new.split('') >>> ['a', 'b', 'c', 'd'] join
57.
'small'.upper() >>>'SMALL' 'BIG'.lower() >>> 'big' 'mIxEd'.swapcase() >>>'MiXwD'
58.
Dictionary
59.
menu = { “idly”
: 2.50, “dosai” : 10.00, “coffee” : 5.00, “ice_cream” : 5.00, 100 : “Hundred” } >>> menu[“idly”] 2.50 >>> menu[100] ”Hundred” >>> menu.get(“tea”, None) None
60.
uwind = { “latitude”
: (-90, 90), “longitude” : (0, 360), “level” : 850, “time” : “2013-07-17”, “units” : None } uwind.keys() uwind.values() for key, value in uwind.iteritems(): print key, ' = ', value
61.
Q) So tell me now, 'what is the use of dictionary ?'
62.
Q) So tell me now, 'what is the use of dictionary ?' Do you know dictionary can take even a function as value in it.
63.
Function
64.
def sayHello(): print 'Hello World!' # block belonging of fn # End of function sayHello() # call the function
65.
def printMax(a, b): if a > b: print a, 'is maximum' else: print b, 'is maximum' printMax(3, 4)
66.
def getMax(a, b): if a > b: return a print “I will not be printed” # end of if a > b: return b # end of def getMax(a, b): mymax = getMax(3, 4) print mymax
67.
Q) Write a function to print the passed argument number is even or odd...
68.
Q) Write a function to print the passed argument number is even or odd... def printEvenOrOdd(no): print “The passed no “, no, if no % 2 == 0: # condition print “ is even” else: print “ is odd” printEvenOrOdd(10)
69.
Using in built Modules
70.
#!/usr/bin/python # Filename: using_sys.py import time print 'The sleep started' time.sleep(3) print 'The sleep finished'
71.
#!/usr/bin/python import os os.listdir('/home/arulalan') os.mkdir('/home/arulalan/Fun') print dir(os)
72.
Making Our Own Modules
73.
#!/usr/bin/python # Filename: mymodule.py def sayhi(): print “Hi, this is mymodule speaking.” version = '0.1' # End of mymodule.py
74.
#!/usr/bin/python # Filename: mymodule_demo.py import mymodule mymodule.sayhi() print 'Version', mymodule.version
75.
#!/usr/bin/python # Filename: mymodule_demo2.py from mymodule import sayhi, version # Alternative: # from mymodule import * sayhi() print 'Version', version
76.
Class
77.
class Person: pass # An empty block p = Person() print p Classes
78.
class Person: def sayHi(self): print 'Hello, how are you?' p = Person() p.sayHi() Classes
79.
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() Classes
80.
Inheritance Classes
81.
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() Classes
82.
class A: var = 10 def __init__(self): self.public = 100 self._protected_ = 'protected' self.__private__ = 'private' Class B(A): pass p = B() p.__protected__ Classes
83.
File Handling
84.
File Writing
85.
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()
86.
Q) How can we write CSV files ? f = open('nos.csv', 'w') # open for 'w'riting for no in range(10): f.write(str(no) + ',' + str(no * no) + 'n') f.close()
87.
File Reading
88.
f = file('poem.txt','r') for line in f.readlines(): print line f.close()
89.
THE END of code :)
90.
How to learn ?
91.
Python – Shell ● Interactive Python ● Instance Responce ●
Learn as you type
92.
bpython ipython } teach you very easily
93.
Python can communicate With Other Languages
94.
C + Python
95.
96.
Java + Python
97.
98.
GUI With Python
99.
100.
Glade + Python + GTK = GUI APP
101.
GLADE
102.
Using Glade + Python
103.
Web Web
104.
Web Frame Work in Python
105.
106.
107.
Python / CDAT Tips Blog Links http://pyaos.johnnylin.com/?page_id=10 http://pyaos.johnnylin.com/?page_id=807 http://www.johnnylin.com/cdat_tips/ http://pyaos.johnnylin.com/
Descargar ahora