SlideShare a Scribd company logo
1 of 44
Download to read offline
What is Python?
http://www.python.org
Platform Independent
Interpreter
Object-oriented
Dynamically typed
Interactive
Script Mode
Interactive Mode
>>> import antigravity
Why Python?
Easy
Powerful
Extensible and Flexible
Interpreted
Object-oriented
Dynamic
Orthogonally structured
Embeddable
And Free
The Zen of Python, by Tim Peters
!
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
>>> import this
파이썬의 선(禪) 팀 피터슨
!
아름다움이 추함보다 좋다.
명시가 암시보다 좋다.
단순함이 복잡함보다 좋다.
복잡함이 꼬인 것보다 좋다.
수평이 계층보다 좋다.
여유로운 것이 밀집한 것보다 좋다.
가독성은 중요하다.
특별한 경우라는 것은 규칙을 어겨야 할 정도로 특별한 것이 아니다.
허나 실용성은 순수성에 우선한다.
오류 앞에서 절대 침묵하지 말지어다.
명시적으로 오류를 감추려는 의도가 아니라면.
모호함을 앞에 두고, 이를 유추하겠다는 유혹을 버려라.
어떤 일에든 명확하고 바람직하며 유일한 방법이 존재한다.
비록 그대가 우둔하여 그 방법이 처음에는 명확해 보이지 않을지라도.
지금 하는게 아예 안하는 것보다 낫다.
아예 안하는 것이 지금 *당장*보다 나을 때도 있지만.
구현 결과를 설명하기 어렵다면, 그 아이디어는 나쁘다.
구현 결과를 설명하기 쉽다면, 그 아이디어는 좋은 아이디어일 수 있다.
네임스페이스는 대박이다 -- 마구 남용해라!
>>>
C vs Java vs Python
C, Hello World
#include <stdio.h>	
int main(int argc, char *argv[]) 	
{	
	 printf("Hello World n");	
	 return 0;	
}
JAVA, Hello World
class HelloWorld {	
	 public static void main(String[] args) {	
	 	 System.out.println("Hello World");	
	 }	
}
Python, Hello World
print "Hello World"
Find Array Value, C
#include <stdio.h>	
!
#define ARR_LEN 5	
!
int main(int argc, char *argv[]) 	
{	
	 int nArr[ARR_LEN] = {10, 20, 30, 40, 50};	
	 int nVal=20;	
	 int i, nCnt=0;	
	 	
	 for(i=0; i<ARR_LEN; i++)	
	 {	
	 	 if(nArr[i] == nVal)	
	 	 {	
	 	 	 printf("True %d n", nVal);	
	 	 	 break;	
	 	 }	
	 	 else nCnt++;	
	 }	
	 if(nCnt == ARR_LEN) printf("False %d n", nVal);	
	 	
	 return 0;	
}
Find Array Value, JAVA
class TestClass {	
	 public static void main(String[] args) {	
	 	 Integer nArr[] = {10, 20, 30, 40, 50};	
	 	 int nVal = 60;	
	 	 int nCnt=0;	 	
	 	 	 	
	 	 for(int i=0; i<nArr.length; i++){	
	 	 	 if(nVal == nArr[i]){	
	 	 	 	 System.out.println("True : "+nVal);	
	 	 	 	 break;	
	 	 	 }	
	 	 	 else nCnt++;	
	 	 }	
	 	 if(nCnt==nArr.length)	
	 	 	 System.out.println("False : "+nVal);	
	 }	
}
Find Array Value, Python
nArr = [10, 20, 30, 40, 50]	
nVal = 20	
if nVal in nArr:	
	 print"True %d" % (nVal)	
else:	
	 print "False %d " % (nVal)
Indent
Indent of C
int main(int argc, char *argv[]) 	
{	
	 printf("Hello World n");	
	 return 0;	
}	
!
int main(int argc, char *argv[]) 	
{	printf("Hello World n");	return 0;}	
!
int main(int argc, char *argv[]){	
printf("Hello World n");	
return 0;}
Indent of Python
if a == 10:	
	 print "a : 10"	
else:	
	 print "a : %d" % (a)
if a == 10: print "a : 10"	
else: print "a : %d" % (a)
if a == 10: 	
	 print "a : 10"	
else:	
	 print "a : %d" % (a)	
	 	 print ("Done") # Error !!
def func(nNum):	
	 nNum+=1	
	 return nNum	
def func(nNum):	
	 nNum+=1	
	 	 print "Error" # Error	
	 return nNum
class Bird(object):	
	 head = 1	
	 body = 1	
	 wing = 2	
	 leg = 2	
	 	
	 def fly(self):	
	 	 print "Fly"
Data Type
Everything is object
a = 10	
b = 20	
c = 10	
!
print "1) a ID : %d " % (id(a))	
print "2) 10 ID : %d " % (id(10))	
print "3) b ID : %d " % (id(b))	
print "4) 20 ID : %d " % (id(20))	
print "5) c ID : %d " % (id(c))
1) a ID : 140286848207040
2) 10 ID : 140286848207040
3) b ID : 140286848206800
4) 20 ID : 140286848206800
5) c ID : 140286848207040
Number
String
List
Tuple
Dictionary
Number
• Integer
nANum = 10	
nBNum = -10	
nCNum = 0
• Floating-point number
nfANum = 1.2	
nfBNum = -3.45	
nfCNum = 4.24E10	
nfDNum = 4.24e-10
Number
• Octal
• Hexadecimal
• Complex number
noANum = 0o177
nhANum = 0xFFF1
nCNum = 10+2j	
print nCNum	
print nCNum.real	
print nCNum.imag
Number operations
nA = 10	
nB = 20 	
!
print nA+nB	
print nA-nB	
print nB/nA	
print 30%11	
print 2**10
String
str1 = "Hello World" 	
print str1	
!
str2 = 'Python is fun' 	
print str2	
!
str3 = """Life is too short, You need python""" 	
print str3	
!
str4 = '''Life is too shor, You need python'''	
print str4	
!
str5 = "Python's favorite food is perl"	
print str5	
!
str6 = '"Python is very easy." he says.' 	
print str6	
!
str7= "Life is too shortnYou need python"	
print str7
Hello World
Python is fun
Life is too short, You need python
Life is too short, You need python
Python's favorite food is perl
"Python is very easy." he says.
Life is too short
You need python
String operation
head = "Python"	
tail = " is fun!"	
print(head + tail)	
!
!
a = "python"	
print(a * 2)	
!
!
print("=" * 11)	
print("My Program")	
print("=" * 11)
Python is fun!
pythonpython
===========
My Program
===========
str1 = "Life is too short, You need Python"	
print str1[0]	
!
!
print str1[-1]	
!
!
str2 = str1[0] + str1[1] + str1[2] + str1[3]	
print str2	
!
!
str3 = str1[0:4]	
print str2	
!
!
str4 = str1[19:]	
print str4	
!
!
str5 = str1[:17]	
print str5
L
n
Life
Life
You need Python
Life is too short
List
Array
List
!
emptyList = []	
nList = [10, 20, 30, 40, 50]	
szList = ["Kim", "Dae", "Gap"]	
stList = ["Kim", "Dae", "Gap", 10, 20]	
!
print emptyList	
print nList	
print szList	
print stList
->Result
[]
[10, 20, 30, 40, 50]
['Kim', 'Dae', 'Gap']
['Kim', 'Dae', 'Gap', 10, 20]
List
nList.append(60)	
print nList	
!
szList.insert(1, '-')	
print szList	
!
del stList[3]	
print stList
-> Result
[10, 20, 30, 40, 50, 60]
['Kim', '-', 'Dae', ‘Gap']
['Kim', 'Dae', 'Gap', 20]
Tuple
Constancy
Tuple
tTu1 = ()	
tTu2 = (10,)	
tTu3 = (10, 20, 30)	
tTu4 = 10, 20, 30	
tTu5 = ('Kim', 10, 'Dae', 20, 'Gap')	
!
print tTu1	
print tTu2	
print tTu3	
print tTu4	
print tTu5	
—> Result
()
(10,)
(10, 20, 30)
(10, 20, 30)
('Kim', 10, 'Dae', 20, 'Gap')
Tuple
lName = ["Kim Dae-Gap", "Sistar", "Girlsday", "Psy"]	
lAge = [29, 22, 20, 38]	
lAddr = ["Suwon", "Seoul", "Pusan", "Gang-Nam"]	
tProfile = (lName, lAge, lAddr)	
print tProfile	
!
tProfile[0].append("JYP")	
tProfile[1].append(40)	
tProfile[2].append("NY")	
print tProfile
—> Result
(['Kim Dae-Gap', 'Sistar', 'Girlsday', 'Psy'], [29, 22, 20, 38], ['Suwon', 'Seoul', 'Pusan', 'Gang-Nam'])
(['Kim Dae-Gap', 'Sistar', 'Girlsday', 'Psy', 'JYP'], [29, 22, 20, 38, 40], ['Suwon', 'Seoul', 'Pusan', 'Gang-Nam', 'NY'])
Dictionary
Key = Value
Dictionary
dProfile = {'name':'dgkim', 'phone':'01040575212', 'birthyday': '0127'}	
print dProfile	
!
!
print dProfile['name']	
!
!
dProfile['addr'] = 'suwon'	
print dProfile[‘addr']	
!
!
print dProfile.keys()	
!
!
print dProfile.values()
if 'name' in dProfile:	
	 print dProfile.get('name')	
else:	
	 print "no name”	
!
!
!
dProfile.clear()	
print dProfile
{'phone': '01040575212', 'name': 'dgkim', 'birthyday': '0127'}
dgkim
suwon
['addr', 'phone', 'name', 'birthyday']
['suwon', '01040575212', 'dgkim', '0127']
Function and Class
Function
def funcSum(a, b):	
	 rst = a+b	
	 return rst	
def manyArg(type, *args): 	
	 sum = 0 	
	 print type	
	 for i in args: 	
	 	 sum = sum + i 	
	 return sum
print funcSum(10, 10) print manyArg('type', 10, 20, 30, 40)
20 type
100
Classclass profile:	
	 def __init__(self):	
	 	 self.name = ''	
	 	 self.age = 0	
	 	 self.addr = ''	
	 	
	 def setName(self, name):	
	 	 self.name = name	
	 	
	 def setAge(self, age):	
	 	 self.age = age	
	 	
	 def setAddr(self, addr):	
	 	 self.addr = addr	
	 	 	
	 def __str__(self):	
	 	 str = ''	
	 	 str += ('='*20)+'n'	
	 	 str += "Name : %s n" % (self.name)	
	 	 str += "Age : %d n" % (self.age)	
	 	 str += "Addr : %s n" % (self.addr)	
	 	 str += ('='*20)+'n'	
	 	 return str	
	 	
pro = profile()	
pro.setName('dgkim')	
pro.setAge(29)	
pro.setAddr('suwon')	
!
print pro
====================
Name : dgkim
Age : 29
Addr : suwon
====================
Class
class member(profile):	
	 	
	 def __init__(self):	
	 	 profile.__init__(self)	
	 	 self.desc =''	
	 	
	 def setDesc(self, desc):	
	 	 self.desc = desc	
	 	 	
	 def __str__(self):	
	 	 str = ''	
	 	 str += ('='*20)+'n'	
	 	 str += "Name : %s n" % (self.name)	
	 	 str += "Age : %d n" % (self.age)	
	 	 str += "Addr : %s n" % (self.addr)	
	 	 str += "desc : %s n" % (self.desc)	
	 	 str += ('='*20)+'n'	
	 	 return str
!
mem = member()	
mem.setName('KKK')	
mem.setAge(22)	
mem.setAddr('seoul')	
mem.setDesc('Solo')	
print mem
====================
Name : KKK
Age : 22
Addr : seoul
desc : Solo
====================
Reference
• Official site http://python.org/
• Study site http://www.codecademy.com/tracks/python
• WiKi docs https://wikidocs.net/book/1
How can use the Python for IPRON ?

More Related Content

What's hot

What's hot (20)

Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 
Python | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python TutorialPython | What is Python | History of Python | Python Tutorial
Python | What is Python | History of Python | Python Tutorial
 
Python
PythonPython
Python
 
Introduction to python programming
Introduction to python programmingIntroduction to python programming
Introduction to python programming
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Python programming
Python  programmingPython  programming
Python programming
 
Python
PythonPython
Python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Intro to Python
Intro to PythonIntro to Python
Intro to Python
 
Python by Rj
Python by RjPython by Rj
Python by Rj
 
Python ppt
Python pptPython ppt
Python ppt
 
Introduction to Python Basics Programming
Introduction to Python Basics ProgrammingIntroduction to Python Basics Programming
Introduction to Python Basics Programming
 
Python
PythonPython
Python
 
Python - the basics
Python - the basicsPython - the basics
Python - the basics
 
Python final ppt
Python final pptPython final ppt
Python final ppt
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Python Sequence | Python Lists | Python Sets & Dictionary | Python Strings | ...
Python Sequence | Python Lists | Python Sets & Dictionary | Python Strings | ...Python Sequence | Python Lists | Python Sets & Dictionary | Python Strings | ...
Python Sequence | Python Lists | Python Sets & Dictionary | Python Strings | ...
 
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | EdurekaPython Tutorial | Python Tutorial for Beginners | Python Training | Edureka
Python Tutorial | Python Tutorial for Beginners | Python Training | Edureka
 
Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3Zero to Hero - Introduction to Python3
Zero to Hero - Introduction to Python3
 

Viewers also liked

Taller arancelario notass
Taller arancelario notassTaller arancelario notass
Taller arancelario notassAndrea Salazar
 
Device interface (090721)
Device interface (090721)Device interface (090721)
Device interface (090721)대갑 김
 
Guia de laboratorio nº 2
Guia de laboratorio nº 2Guia de laboratorio nº 2
Guia de laboratorio nº 2diego_f_mera
 
Radiação gama
Radiação gamaRadiação gama
Radiação gamaRaildo
 
Guia de laboratorio nº 2
Guia de laboratorio nº 2Guia de laboratorio nº 2
Guia de laboratorio nº 2diego_f_mera
 

Viewers also liked (11)

Taller arancelario notass
Taller arancelario notassTaller arancelario notass
Taller arancelario notass
 
Saude brasileiros revista lancet
Saude brasileiros revista lancetSaude brasileiros revista lancet
Saude brasileiros revista lancet
 
Scannning and indexing_operations
Scannning and indexing_operationsScannning and indexing_operations
Scannning and indexing_operations
 
Device interface (090721)
Device interface (090721)Device interface (090721)
Device interface (090721)
 
Bases de datos
Bases de datosBases de datos
Bases de datos
 
Guia de laboratorio nº 2
Guia de laboratorio nº 2Guia de laboratorio nº 2
Guia de laboratorio nº 2
 
D&G presentación oficial
D&G presentación oficialD&G presentación oficial
D&G presentación oficial
 
Saude brasileiros revista lancet
Saude brasileiros revista lancetSaude brasileiros revista lancet
Saude brasileiros revista lancet
 
Radiação gama
Radiação gamaRadiação gama
Radiação gama
 
02 pauta y_tabla_de_notacion_interna0
02 pauta y_tabla_de_notacion_interna002 pauta y_tabla_de_notacion_interna0
02 pauta y_tabla_de_notacion_interna0
 
Guia de laboratorio nº 2
Guia de laboratorio nº 2Guia de laboratorio nº 2
Guia de laboratorio nº 2
 

Similar to Python

Similar to Python (20)

Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
 
ADA FILE
ADA FILEADA FILE
ADA FILE
 
Class 2: Welcome part 2
Class 2: Welcome part 2Class 2: Welcome part 2
Class 2: Welcome part 2
 
GE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python ProgrammingGE8151 Problem Solving and Python Programming
GE8151 Problem Solving and Python Programming
 
Python quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung FuPython quickstart for programmers: Python Kung Fu
Python quickstart for programmers: Python Kung Fu
 
Python basic
Python basic Python basic
Python basic
 
Python slide
Python slidePython slide
Python slide
 
Idioms in swift 2016 05c
Idioms in swift 2016 05cIdioms in swift 2016 05c
Idioms in swift 2016 05c
 
Data Structure using C
Data Structure using CData Structure using C
Data Structure using C
 
Python crush course
Python crush coursePython crush course
Python crush course
 
仕事で使うF#
仕事で使うF#仕事で使うF#
仕事で使うF#
 
C tutorial
C tutorialC tutorial
C tutorial
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
python codes
python codespython codes
python codes
 
Cpds lab
Cpds labCpds lab
Cpds lab
 
Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Python Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard WayPython Workshop - Learn Python the Hard Way
Python Workshop - Learn Python the Hard Way
 
Music as data
Music as dataMusic as data
Music as data
 
Learn 90% of Python in 90 Minutes
Learn 90% of Python in 90 MinutesLearn 90% of Python in 90 Minutes
Learn 90% of Python in 90 Minutes
 
Vcs16
Vcs16Vcs16
Vcs16
 

Recently uploaded

BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Recently uploaded (20)

BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Python

  • 1.
  • 5.
  • 9. The Zen of Python, by Tim Peters ! Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren't special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one-- and preferably only one --obvious way to do it. Although that way may not be obvious at first unless you're Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, it's a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- let's do more of those! >>> import this
  • 10. 파이썬의 선(禪) 팀 피터슨 ! 아름다움이 추함보다 좋다. 명시가 암시보다 좋다. 단순함이 복잡함보다 좋다. 복잡함이 꼬인 것보다 좋다. 수평이 계층보다 좋다. 여유로운 것이 밀집한 것보다 좋다. 가독성은 중요하다. 특별한 경우라는 것은 규칙을 어겨야 할 정도로 특별한 것이 아니다. 허나 실용성은 순수성에 우선한다. 오류 앞에서 절대 침묵하지 말지어다. 명시적으로 오류를 감추려는 의도가 아니라면. 모호함을 앞에 두고, 이를 유추하겠다는 유혹을 버려라. 어떤 일에든 명확하고 바람직하며 유일한 방법이 존재한다. 비록 그대가 우둔하여 그 방법이 처음에는 명확해 보이지 않을지라도. 지금 하는게 아예 안하는 것보다 낫다. 아예 안하는 것이 지금 *당장*보다 나을 때도 있지만. 구현 결과를 설명하기 어렵다면, 그 아이디어는 나쁘다. 구현 결과를 설명하기 쉽다면, 그 아이디어는 좋은 아이디어일 수 있다. 네임스페이스는 대박이다 -- 마구 남용해라! >>>
  • 11. C vs Java vs Python
  • 12. C, Hello World #include <stdio.h> int main(int argc, char *argv[]) { printf("Hello World n"); return 0; }
  • 13. JAVA, Hello World class HelloWorld { public static void main(String[] args) { System.out.println("Hello World"); } }
  • 14. Python, Hello World print "Hello World"
  • 15. Find Array Value, C #include <stdio.h> ! #define ARR_LEN 5 ! int main(int argc, char *argv[]) { int nArr[ARR_LEN] = {10, 20, 30, 40, 50}; int nVal=20; int i, nCnt=0; for(i=0; i<ARR_LEN; i++) { if(nArr[i] == nVal) { printf("True %d n", nVal); break; } else nCnt++; } if(nCnt == ARR_LEN) printf("False %d n", nVal); return 0; }
  • 16. Find Array Value, JAVA class TestClass { public static void main(String[] args) { Integer nArr[] = {10, 20, 30, 40, 50}; int nVal = 60; int nCnt=0; for(int i=0; i<nArr.length; i++){ if(nVal == nArr[i]){ System.out.println("True : "+nVal); break; } else nCnt++; } if(nCnt==nArr.length) System.out.println("False : "+nVal); } }
  • 17. Find Array Value, Python nArr = [10, 20, 30, 40, 50] nVal = 20 if nVal in nArr: print"True %d" % (nVal) else: print "False %d " % (nVal)
  • 19. Indent of C int main(int argc, char *argv[]) { printf("Hello World n"); return 0; } ! int main(int argc, char *argv[]) { printf("Hello World n"); return 0;} ! int main(int argc, char *argv[]){ printf("Hello World n"); return 0;}
  • 20. Indent of Python if a == 10: print "a : 10" else: print "a : %d" % (a) if a == 10: print "a : 10" else: print "a : %d" % (a) if a == 10: print "a : 10" else: print "a : %d" % (a) print ("Done") # Error !! def func(nNum): nNum+=1 return nNum def func(nNum): nNum+=1 print "Error" # Error return nNum class Bird(object): head = 1 body = 1 wing = 2 leg = 2 def fly(self): print "Fly"
  • 23.
  • 24. a = 10 b = 20 c = 10 ! print "1) a ID : %d " % (id(a)) print "2) 10 ID : %d " % (id(10)) print "3) b ID : %d " % (id(b)) print "4) 20 ID : %d " % (id(20)) print "5) c ID : %d " % (id(c)) 1) a ID : 140286848207040 2) 10 ID : 140286848207040 3) b ID : 140286848206800 4) 20 ID : 140286848206800 5) c ID : 140286848207040
  • 26. Number • Integer nANum = 10 nBNum = -10 nCNum = 0 • Floating-point number nfANum = 1.2 nfBNum = -3.45 nfCNum = 4.24E10 nfDNum = 4.24e-10
  • 27. Number • Octal • Hexadecimal • Complex number noANum = 0o177 nhANum = 0xFFF1 nCNum = 10+2j print nCNum print nCNum.real print nCNum.imag
  • 28. Number operations nA = 10 nB = 20 ! print nA+nB print nA-nB print nB/nA print 30%11 print 2**10
  • 29. String str1 = "Hello World" print str1 ! str2 = 'Python is fun' print str2 ! str3 = """Life is too short, You need python""" print str3 ! str4 = '''Life is too shor, You need python''' print str4 ! str5 = "Python's favorite food is perl" print str5 ! str6 = '"Python is very easy." he says.' print str6 ! str7= "Life is too shortnYou need python" print str7 Hello World Python is fun Life is too short, You need python Life is too short, You need python Python's favorite food is perl "Python is very easy." he says. Life is too short You need python
  • 30. String operation head = "Python" tail = " is fun!" print(head + tail) ! ! a = "python" print(a * 2) ! ! print("=" * 11) print("My Program") print("=" * 11) Python is fun! pythonpython =========== My Program =========== str1 = "Life is too short, You need Python" print str1[0] ! ! print str1[-1] ! ! str2 = str1[0] + str1[1] + str1[2] + str1[3] print str2 ! ! str3 = str1[0:4] print str2 ! ! str4 = str1[19:] print str4 ! ! str5 = str1[:17] print str5 L n Life Life You need Python Life is too short
  • 32. List ! emptyList = [] nList = [10, 20, 30, 40, 50] szList = ["Kim", "Dae", "Gap"] stList = ["Kim", "Dae", "Gap", 10, 20] ! print emptyList print nList print szList print stList ->Result [] [10, 20, 30, 40, 50] ['Kim', 'Dae', 'Gap'] ['Kim', 'Dae', 'Gap', 10, 20]
  • 33. List nList.append(60) print nList ! szList.insert(1, '-') print szList ! del stList[3] print stList -> Result [10, 20, 30, 40, 50, 60] ['Kim', '-', 'Dae', ‘Gap'] ['Kim', 'Dae', 'Gap', 20]
  • 35. Tuple tTu1 = () tTu2 = (10,) tTu3 = (10, 20, 30) tTu4 = 10, 20, 30 tTu5 = ('Kim', 10, 'Dae', 20, 'Gap') ! print tTu1 print tTu2 print tTu3 print tTu4 print tTu5 —> Result () (10,) (10, 20, 30) (10, 20, 30) ('Kim', 10, 'Dae', 20, 'Gap')
  • 36. Tuple lName = ["Kim Dae-Gap", "Sistar", "Girlsday", "Psy"] lAge = [29, 22, 20, 38] lAddr = ["Suwon", "Seoul", "Pusan", "Gang-Nam"] tProfile = (lName, lAge, lAddr) print tProfile ! tProfile[0].append("JYP") tProfile[1].append(40) tProfile[2].append("NY") print tProfile —> Result (['Kim Dae-Gap', 'Sistar', 'Girlsday', 'Psy'], [29, 22, 20, 38], ['Suwon', 'Seoul', 'Pusan', 'Gang-Nam']) (['Kim Dae-Gap', 'Sistar', 'Girlsday', 'Psy', 'JYP'], [29, 22, 20, 38, 40], ['Suwon', 'Seoul', 'Pusan', 'Gang-Nam', 'NY'])
  • 38. Dictionary dProfile = {'name':'dgkim', 'phone':'01040575212', 'birthyday': '0127'} print dProfile ! ! print dProfile['name'] ! ! dProfile['addr'] = 'suwon' print dProfile[‘addr'] ! ! print dProfile.keys() ! ! print dProfile.values() if 'name' in dProfile: print dProfile.get('name') else: print "no name” ! ! ! dProfile.clear() print dProfile {'phone': '01040575212', 'name': 'dgkim', 'birthyday': '0127'} dgkim suwon ['addr', 'phone', 'name', 'birthyday'] ['suwon', '01040575212', 'dgkim', '0127']
  • 40. Function def funcSum(a, b): rst = a+b return rst def manyArg(type, *args): sum = 0 print type for i in args: sum = sum + i return sum print funcSum(10, 10) print manyArg('type', 10, 20, 30, 40) 20 type 100
  • 41. Classclass profile: def __init__(self): self.name = '' self.age = 0 self.addr = '' def setName(self, name): self.name = name def setAge(self, age): self.age = age def setAddr(self, addr): self.addr = addr def __str__(self): str = '' str += ('='*20)+'n' str += "Name : %s n" % (self.name) str += "Age : %d n" % (self.age) str += "Addr : %s n" % (self.addr) str += ('='*20)+'n' return str pro = profile() pro.setName('dgkim') pro.setAge(29) pro.setAddr('suwon') ! print pro ==================== Name : dgkim Age : 29 Addr : suwon ====================
  • 42. Class class member(profile): def __init__(self): profile.__init__(self) self.desc ='' def setDesc(self, desc): self.desc = desc def __str__(self): str = '' str += ('='*20)+'n' str += "Name : %s n" % (self.name) str += "Age : %d n" % (self.age) str += "Addr : %s n" % (self.addr) str += "desc : %s n" % (self.desc) str += ('='*20)+'n' return str ! mem = member() mem.setName('KKK') mem.setAge(22) mem.setAddr('seoul') mem.setDesc('Solo') print mem ==================== Name : KKK Age : 22 Addr : seoul desc : Solo ====================
  • 43. Reference • Official site http://python.org/ • Study site http://www.codecademy.com/tracks/python • WiKi docs https://wikidocs.net/book/1
  • 44. How can use the Python for IPRON ?