SlideShare uma empresa Scribd logo
1 de 6
Baixar para ler offline
Untitled0                                       http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [1]: a = 'bonjour calvix'


         In [2]: print a

                  bonjour calvix

         In [3]: a='bonjour'


         In [4]: a = "bonjour"


         In [5]: a

         Out[5]: 'bonjour'


         In [6]: a= 42


         In [7]: print a

                  42

         In [8]: a = 10
                 b = 20
                 c = a + b



         In [9]: print c

                  30

         In [10]: 3*4

         Out[10]: 12


         In [11]: 3-2

         Out[11]: 1


         In [12]: 4/2

         Out[12]: 2


         In [13]: 5/2

         Out[13]: 2


         In [14]: 5.0/2

         Out[14]: 2.5


         In [16]: type(10)

         Out[16]: int


         In [17]: type(10.0)

         Out[17]: float


         In [18]: type('blabla')

         Out[18]: str


         In [19]: 10,5

         Out[19]: (10, 5)


         In [21]: # operateurs classique +-=/


         In [23]: 5%2

         Out[23]: 1




1 of 6                                                                                13/01/2012 22:09
Untitled0                                                                     http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [26]: 'foo    ' + 'b a r'

         Out[26]: 'foo    b a r'


         In [28]: 'foo' + 10

                  ---------------------------------------------------------------------------
                  TypeError                                 Traceback (most recent call last)
                  /home/nicolas/<ipython-input-28-89215d4a8e7f> in <module>()
                  ----> 1 'foo' + 10

                  TypeError: cannot concatenate 'str' and 'int' objects



         In [30]: 'foo' + '10'

         Out[30]: 'foo10'


         In [32]: 'foo' + str(10)

         Out[32]: 'foo10'


         In [35]: 'foo' * 5

         Out[35]: 'foofoofoofoofoo'


         In [37]: prenom = 'nicolas'
                  'bonjour, %s' % prenom


         Out[37]: 'bonjour, nicolas'


         In [39]: 'bonjour, {}'.format(prenom)

         Out[39]: 'bonjour, nicolas'


         In [40]: # Boolene


         In [41]: True #False

         Out[41]: True


         In [42]: b = [29, 'foo', a]


         In [44]: b

         Out[44]: [29, 'foo', 10]


         In [46]: b[1]

         Out[46]: 'foo'


         In [48]: b[1] = 42


         In [49]: print b

                  [29, 42, 10]

         In [50]: b[5]

                  ---------------------------------------------------------------------------
                  IndexError                                Traceback (most recent call last)
                  /home/nicolas/<ipython-input-50-ca5d543a082a> in <module>()
                  ----> 1 b[5]

                  IndexError: list index out of range




2 of 6                                                                                                              13/01/2012 22:09
Untitled0                                                                      http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [51]: b[3] = 20

                  ---------------------------------------------------------------------------
                  IndexError                                Traceback (most recent call last)
                  /home/nicolas/<ipython-input-51-f517828affd8> in <module>()
                  ----> 1 b[3] = 20

                  IndexError: list assignment index out of range



         In [52]: b.append('calvix')


         In [53]: print b

                  [29, 42, 10, 'calvix']

         In [54]: len(b)

         Out[54]: 4


         In [55]: b.append(20)


         In [56]: print b

                  [29, 42, 10, 'calvix', 20]

         In [58]: b.append([20, 'linux'])


         In [59]: print b

                  [29, 42, 10, 'calvix', 20, [20, 'linux'], [20, 'linux']]

         In [60]: b.extend([30, 'torvalds'])


         In [61]: print b

                  [29, 42, 10, 'calvix', 20, [20, 'linux'], [20, 'linux'], 30, 'torvalds']

         In [64]: b.count([20, 'linux'])

         Out[64]: 2


         In [67]: print b.pop()

                  [20, 'linux']

         In [68]: # Tuple


         In [70]: a = (20, 'calvix', 30)



         In [71]: print a

                  (20, 'calvix', 30)

         In [72]: a[1] = 'linux'

                  ---------------------------------------------------------------------------
                  TypeError                                 Traceback (most recent call last)
                  /home/nicolas/<ipython-input-72-228477c61ecf> in <module>()
                  ----> 1 a[1] = 'linux'

                  TypeError: 'tuple' object does not support item assignment



         In [73]: 30, 'calvix'

         Out[73]: (30, 'calvix')


         In [74]: 'calvix'

         Out[74]: 'calvix'


         In [75]: a = 'ping'




3 of 6                                                                                                               13/01/2012 22:09
Untitled0                                                                       http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [77]: print a[1]

                  i

         In [78]: a[1] = 'o'

                  ---------------------------------------------------------------------------
                  TypeError                                 Traceback (most recent call last)
                  /home/nicolas/<ipython-input-78-a1f251c3625e> in <module>()
                  ----> 1 a[1] = 'o'

                  TypeError: 'str' object does not support item assignment



         In [81]: a = {1: 'un', 2: 'deux', 'linus': 'torvalds', 'GNU': 'RMS'}


         In [82]: a[1]

         Out[82]: 'un'


         In [83]: a[3]

                  ---------------------------------------------------------------------------
                  KeyError                                  Traceback (most recent call last)
                  /home/nicolas/<ipython-input-83-94e7916e7615> in <module>()
                  ----> 1 a[3]

                  KeyError: 3



         In [85]: a['GNU'] = 42


         In [87]: print a

                  {1: 'un', 2: 'deux', 'linus': 'torvalds', 'GNU': 42}

         In [88]: print a['linus']

                  torvalds

         In [89]: conf = {'taille': 30, 'largeur': 20, 'couleur': 'bleu'}


         In [90]: conf['couleur']

         Out[90]: 'bleu'


         In [91]: # affectation de valeur à une variable
                  a = 10


         In [93]: # Comparaison de valeurs
                  a == 12


         Out[93]: False


         In [94]: # > < <= >= == !=


         In [97]: age = 70
                  if age >= 60:
                      print 'vieux'
                  elif age < 20:
                      print 'très jeune'
                  else:
                      print 'jeune'



                  vieux

         In [98]: tableau = ['foo', 'bar', 42]


         In [99]: 'foo' in tableau

         Out[99]: True




4 of 6                                                                                                                13/01/2012 22:09
Untitled0                                                                      http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [101]: if 'calvix' in tableau:
                       print 'c'est dans le tableau'
                   else:
                       print 'pas grave'


                  pas grave

         In [102]: for element in tableau:
                       print element

                  foo
                  bar
                  42

         In [105]: for i, item in enumerate(tableau):
                       print i, item

                  0 foo
                  1 bar
                  2 42

         In [106]: for i in range(10):
                       print i

                  0
                  1
                  2
                  3
                  4
                  5
                  6
                  7
                  8
                  9

         In [107]: i=0
                   i += 1


         In [108]: print i

                  1

         In [109]: #équivaut à; i = i + 1


         In [110]: # n'existe pas avec python i++;i--;


         In [114]: i = 0
                   while i < 5:
                       print 'i vaut %s' % i
                       i += 1


                  i   vaut   0
                  i   vaut   1
                  i   vaut   2
                  i   vaut   3
                  i   vaut   4

         In [132]: def bonjour (prenom, age):
                       if age < 0:
                           raise ValueError
                       print 'bonjour %s, j'ai %s ans' % (prenom, str(age))



         In [134]: try:
                       bonjour('nicolas', -10)
                   except ValueError:
                       print 'exception levée'


                  exception levée

         In [139]: def add (a, b):
                       return a+b



         In [140]: add(40, 2)

         Out[140]: 42




5 of 6                                                                                                               13/01/2012 22:09
Untitled0                                                                      http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a...


         In [141]: def valeur(a, b):
                       return a, b


         In [142]: x, y = valeur(20, 30)


         In [143]: print x

                     20

         In [150]: class Point:
                       def __init__(self, x, y):
                           self._valeur= 30
                           self.x = x
                           self.y = y




         In [148]: a = Point(20, 30)



         In [149]: a.x

         Out[149]: 20


         In [151]: a = add


         In [152]: print a

                     <function add at 0x96f7844>

         In [153]: a(3, 5)

         Out[153]: 8


         In [153]:


         In [158]: a = 'UnE PhRase ExeMple'



         In [159]: a.capitalize()

         Out[159]: 'Une phrase exemple'


         In [160]: import string


         In [162]: string.printable

         Out[162]: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+,-./:;<=>?@[]^_`{|}~ tnrx0bx0c'


          In [ ]:




6 of 6                                                                                                                            13/01/2012 22:09

Mais conteúdo relacionado

Mais procurados

Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonChristoph Matthies
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)David de Boer
 
The Ring programming language version 1.5.2 book - Part 66 of 181
The Ring programming language version 1.5.2 book - Part 66 of 181The Ring programming language version 1.5.2 book - Part 66 of 181
The Ring programming language version 1.5.2 book - Part 66 of 181Mahmoud Samir Fayed
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python TricksBryan Helmig
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...DevGAMM Conference
 
Intro to programming games with clojure
Intro to programming games with clojureIntro to programming games with clojure
Intro to programming games with clojureJuio Barros
 
MongoDB Analytics
MongoDB AnalyticsMongoDB Analytics
MongoDB Analyticsdatablend
 
Pandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codePandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codeTim Hong
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Baruch Sadogursky
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with PythonHan Lee
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxyginecorehard_by
 
Python basic
Python basic Python basic
Python basic sewoo lee
 
The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.5.4 book - Part 46 of 185
The Ring programming language version 1.5.4 book - Part 46 of 185The Ring programming language version 1.5.4 book - Part 46 of 185
The Ring programming language version 1.5.4 book - Part 46 of 185Mahmoud Samir Fayed
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTsKevlin Henney
 

Mais procurados (20)

Pybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in PythonPybelsberg — Constraint-based Programming in Python
Pybelsberg — Constraint-based Programming in Python
 
Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)Being functional in PHP (PHPDay Italy 2016)
Being functional in PHP (PHPDay Italy 2016)
 
C++ L04-Array+String
C++ L04-Array+StringC++ L04-Array+String
C++ L04-Array+String
 
EUnit in Practice(Japanese)
EUnit in Practice(Japanese)EUnit in Practice(Japanese)
EUnit in Practice(Japanese)
 
The Ring programming language version 1.5.2 book - Part 66 of 181
The Ring programming language version 1.5.2 book - Part 66 of 181The Ring programming language version 1.5.2 book - Part 66 of 181
The Ring programming language version 1.5.2 book - Part 66 of 181
 
Stupid Awesome Python Tricks
Stupid Awesome Python TricksStupid Awesome Python Tricks
Stupid Awesome Python Tricks
 
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
Самые вкусные баги из игрового кода: как ошибаются наши коллеги-программисты ...
 
Intro to programming games with clojure
Intro to programming games with clojureIntro to programming games with clojure
Intro to programming games with clojure
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
C++ L06-Pointers
C++ L06-PointersC++ L06-Pointers
C++ L06-Pointers
 
MongoDB Analytics
MongoDB AnalyticsMongoDB Analytics
MongoDB Analytics
 
Pandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with codePandas+postgre sql 實作 with code
Pandas+postgre sql 實作 with code
 
Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014Groovy puzzlers по русски с Joker 2014
Groovy puzzlers по русски с Joker 2014
 
Imugi: Compiler made with Python
Imugi: Compiler made with PythonImugi: Compiler made with Python
Imugi: Compiler made with Python
 
C++ game development with oxygine
C++ game development with oxygineC++ game development with oxygine
C++ game development with oxygine
 
Python basic
Python basic Python basic
Python basic
 
The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184The Ring programming language version 1.5.3 book - Part 69 of 184
The Ring programming language version 1.5.3 book - Part 69 of 184
 
The Ring programming language version 1.5.4 book - Part 46 of 185
The Ring programming language version 1.5.4 book - Part 46 of 185The Ring programming language version 1.5.4 book - Part 46 of 185
The Ring programming language version 1.5.4 book - Part 46 of 185
 
Programming with GUTs
Programming with GUTsProgramming with GUTs
Programming with GUTs
 
C++ L11-Polymorphism
C++ L11-PolymorphismC++ L11-Polymorphism
C++ L11-Polymorphism
 

Destaque

Brainstorm accommodatie 2011
Brainstorm accommodatie 2011Brainstorm accommodatie 2011
Brainstorm accommodatie 2011SanderKamp
 
Presentacion informatica
Presentacion informaticaPresentacion informatica
Presentacion informaticamarianella1994
 
ამერიკული რევოლუცია
ამერიკული რევოლუციაამერიკული რევოლუცია
ამერიკული რევოლუციაgiorgidobrev
 
Presentacion informatica
Presentacion informaticaPresentacion informatica
Presentacion informaticamarianella1994
 
Analysis of camarines_sur_governance
Analysis of camarines_sur_governanceAnalysis of camarines_sur_governance
Analysis of camarines_sur_governanceduwangcamarines
 
ACTIVITY_REPORT
ACTIVITY_REPORTACTIVITY_REPORT
ACTIVITY_REPORTrony244
 
Arguments for a_new_province
Arguments for a_new_provinceArguments for a_new_province
Arguments for a_new_provinceduwangcamarines
 
Creative Portfolio
Creative PortfolioCreative Portfolio
Creative Portfoliodmisconish
 
Presentation Design Promo
Presentation Design PromoPresentation Design Promo
Presentation Design Promodmisconish
 
Visual Thinking Talk
Visual Thinking TalkVisual Thinking Talk
Visual Thinking Talkdmisconish
 

Destaque (17)

Bmw
BmwBmw
Bmw
 
Brainstorm accommodatie 2011
Brainstorm accommodatie 2011Brainstorm accommodatie 2011
Brainstorm accommodatie 2011
 
Presentacion informatica
Presentacion informaticaPresentacion informatica
Presentacion informatica
 
ამერიკული რევოლუცია
ამერიკული რევოლუციაამერიკული რევოლუცია
ამერიკული რევოლუცია
 
Angles halloween
Angles halloweenAngles halloween
Angles halloween
 
Presentacion informatica
Presentacion informaticaPresentacion informatica
Presentacion informatica
 
Nc for senate dec2
Nc for senate dec2Nc for senate dec2
Nc for senate dec2
 
K.lang
K.langK.lang
K.lang
 
Analysis of camarines_sur_governance
Analysis of camarines_sur_governanceAnalysis of camarines_sur_governance
Analysis of camarines_sur_governance
 
Hb4820
Hb4820Hb4820
Hb4820
 
ACTIVITY_REPORT
ACTIVITY_REPORTACTIVITY_REPORT
ACTIVITY_REPORT
 
Provincial data
Provincial dataProvincial data
Provincial data
 
Arguments for a_new_province
Arguments for a_new_provinceArguments for a_new_province
Arguments for a_new_province
 
Consultations
ConsultationsConsultations
Consultations
 
Creative Portfolio
Creative PortfolioCreative Portfolio
Creative Portfolio
 
Presentation Design Promo
Presentation Design PromoPresentation Design Promo
Presentation Design Promo
 
Visual Thinking Talk
Visual Thinking TalkVisual Thinking Talk
Visual Thinking Talk
 

Semelhante a Calvix python

A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsMichael Pirnat
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Pythonpugpe
 
You are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfYou are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfsales223546
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersConnor McDonald
 
{- Do not change the skeleton code! The point of this assign.pdf
{-      Do not change the skeleton code! The point of this      assign.pdf{-      Do not change the skeleton code! The point of this      assign.pdf
{- Do not change the skeleton code! The point of this assign.pdfatul2867
 
Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with RYanchang Zhao
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...akaptur
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonakaptur
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181Mahmoud Samir Fayed
 
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxLiterary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxjeremylockett77
 
funwithalgorithms.pptx
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptxTess Ferrandez
 

Semelhante a Calvix python (20)

Python From Scratch (1).pdf
Python From Scratch  (1).pdfPython From Scratch  (1).pdf
Python From Scratch (1).pdf
 
Talk Code
Talk CodeTalk Code
Talk Code
 
A Few of My Favorite (Python) Things
A Few of My Favorite (Python) ThingsA Few of My Favorite (Python) Things
A Few of My Favorite (Python) Things
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
 
Palestra sobre Collections com Python
Palestra sobre Collections com PythonPalestra sobre Collections com Python
Palestra sobre Collections com Python
 
You are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdfYou are task to add a yawning detection to the programme below;i.pdf
You are task to add a yawning detection to the programme below;i.pdf
 
OpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer DisastersOpenWorld 2018 - Common Application Developer Disasters
OpenWorld 2018 - Common Application Developer Disasters
 
Data types
Data typesData types
Data types
 
Computer Programming- Lecture 9
Computer Programming- Lecture 9Computer Programming- Lecture 9
Computer Programming- Lecture 9
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
 
{- Do not change the skeleton code! The point of this assign.pdf
{-      Do not change the skeleton code! The point of this      assign.pdf{-      Do not change the skeleton code! The point of this      assign.pdf
{- Do not change the skeleton code! The point of this assign.pdf
 
Time Series Analysis and Mining with R
Time Series Analysis and Mining with RTime Series Analysis and Mining with R
Time Series Analysis and Mining with R
 
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
Allison Kaptur: Bytes in the Machine: Inside the CPython interpreter, PyGotha...
 
SCIPY-SYMPY.pdf
SCIPY-SYMPY.pdfSCIPY-SYMPY.pdf
SCIPY-SYMPY.pdf
 
Python 1 liners
Python 1 linersPython 1 liners
Python 1 liners
 
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPythonByterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
Byterun, a Python bytecode interpreter - Allison Kaptur at NYCPython
 
Python 1
Python 1Python 1
Python 1
 
The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181The Ring programming language version 1.5.2 book - Part 45 of 181
The Ring programming language version 1.5.2 book - Part 45 of 181
 
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docxLiterary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
Literary Genre MatrixPart 1 Matrix FictionNon-fiction.docx
 
funwithalgorithms.pptx
funwithalgorithms.pptxfunwithalgorithms.pptx
funwithalgorithms.pptx
 

Último

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The 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...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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...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
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 

Último (20)

08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech 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...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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 

Calvix python

  • 1. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [1]: a = 'bonjour calvix' In [2]: print a bonjour calvix In [3]: a='bonjour' In [4]: a = "bonjour" In [5]: a Out[5]: 'bonjour' In [6]: a= 42 In [7]: print a 42 In [8]: a = 10 b = 20 c = a + b In [9]: print c 30 In [10]: 3*4 Out[10]: 12 In [11]: 3-2 Out[11]: 1 In [12]: 4/2 Out[12]: 2 In [13]: 5/2 Out[13]: 2 In [14]: 5.0/2 Out[14]: 2.5 In [16]: type(10) Out[16]: int In [17]: type(10.0) Out[17]: float In [18]: type('blabla') Out[18]: str In [19]: 10,5 Out[19]: (10, 5) In [21]: # operateurs classique +-=/ In [23]: 5%2 Out[23]: 1 1 of 6 13/01/2012 22:09
  • 2. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [26]: 'foo ' + 'b a r' Out[26]: 'foo b a r' In [28]: 'foo' + 10 --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/nicolas/<ipython-input-28-89215d4a8e7f> in <module>() ----> 1 'foo' + 10 TypeError: cannot concatenate 'str' and 'int' objects In [30]: 'foo' + '10' Out[30]: 'foo10' In [32]: 'foo' + str(10) Out[32]: 'foo10' In [35]: 'foo' * 5 Out[35]: 'foofoofoofoofoo' In [37]: prenom = 'nicolas' 'bonjour, %s' % prenom Out[37]: 'bonjour, nicolas' In [39]: 'bonjour, {}'.format(prenom) Out[39]: 'bonjour, nicolas' In [40]: # Boolene In [41]: True #False Out[41]: True In [42]: b = [29, 'foo', a] In [44]: b Out[44]: [29, 'foo', 10] In [46]: b[1] Out[46]: 'foo' In [48]: b[1] = 42 In [49]: print b [29, 42, 10] In [50]: b[5] --------------------------------------------------------------------------- IndexError Traceback (most recent call last) /home/nicolas/<ipython-input-50-ca5d543a082a> in <module>() ----> 1 b[5] IndexError: list index out of range 2 of 6 13/01/2012 22:09
  • 3. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [51]: b[3] = 20 --------------------------------------------------------------------------- IndexError Traceback (most recent call last) /home/nicolas/<ipython-input-51-f517828affd8> in <module>() ----> 1 b[3] = 20 IndexError: list assignment index out of range In [52]: b.append('calvix') In [53]: print b [29, 42, 10, 'calvix'] In [54]: len(b) Out[54]: 4 In [55]: b.append(20) In [56]: print b [29, 42, 10, 'calvix', 20] In [58]: b.append([20, 'linux']) In [59]: print b [29, 42, 10, 'calvix', 20, [20, 'linux'], [20, 'linux']] In [60]: b.extend([30, 'torvalds']) In [61]: print b [29, 42, 10, 'calvix', 20, [20, 'linux'], [20, 'linux'], 30, 'torvalds'] In [64]: b.count([20, 'linux']) Out[64]: 2 In [67]: print b.pop() [20, 'linux'] In [68]: # Tuple In [70]: a = (20, 'calvix', 30) In [71]: print a (20, 'calvix', 30) In [72]: a[1] = 'linux' --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/nicolas/<ipython-input-72-228477c61ecf> in <module>() ----> 1 a[1] = 'linux' TypeError: 'tuple' object does not support item assignment In [73]: 30, 'calvix' Out[73]: (30, 'calvix') In [74]: 'calvix' Out[74]: 'calvix' In [75]: a = 'ping' 3 of 6 13/01/2012 22:09
  • 4. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [77]: print a[1] i In [78]: a[1] = 'o' --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /home/nicolas/<ipython-input-78-a1f251c3625e> in <module>() ----> 1 a[1] = 'o' TypeError: 'str' object does not support item assignment In [81]: a = {1: 'un', 2: 'deux', 'linus': 'torvalds', 'GNU': 'RMS'} In [82]: a[1] Out[82]: 'un' In [83]: a[3] --------------------------------------------------------------------------- KeyError Traceback (most recent call last) /home/nicolas/<ipython-input-83-94e7916e7615> in <module>() ----> 1 a[3] KeyError: 3 In [85]: a['GNU'] = 42 In [87]: print a {1: 'un', 2: 'deux', 'linus': 'torvalds', 'GNU': 42} In [88]: print a['linus'] torvalds In [89]: conf = {'taille': 30, 'largeur': 20, 'couleur': 'bleu'} In [90]: conf['couleur'] Out[90]: 'bleu' In [91]: # affectation de valeur à une variable a = 10 In [93]: # Comparaison de valeurs a == 12 Out[93]: False In [94]: # > < <= >= == != In [97]: age = 70 if age >= 60: print 'vieux' elif age < 20: print 'très jeune' else: print 'jeune' vieux In [98]: tableau = ['foo', 'bar', 42] In [99]: 'foo' in tableau Out[99]: True 4 of 6 13/01/2012 22:09
  • 5. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [101]: if 'calvix' in tableau: print 'c'est dans le tableau' else: print 'pas grave' pas grave In [102]: for element in tableau: print element foo bar 42 In [105]: for i, item in enumerate(tableau): print i, item 0 foo 1 bar 2 42 In [106]: for i in range(10): print i 0 1 2 3 4 5 6 7 8 9 In [107]: i=0 i += 1 In [108]: print i 1 In [109]: #équivaut à; i = i + 1 In [110]: # n'existe pas avec python i++;i--; In [114]: i = 0 while i < 5: print 'i vaut %s' % i i += 1 i vaut 0 i vaut 1 i vaut 2 i vaut 3 i vaut 4 In [132]: def bonjour (prenom, age): if age < 0: raise ValueError print 'bonjour %s, j'ai %s ans' % (prenom, str(age)) In [134]: try: bonjour('nicolas', -10) except ValueError: print 'exception levée' exception levée In [139]: def add (a, b): return a+b In [140]: add(40, 2) Out[140]: 42 5 of 6 13/01/2012 22:09
  • 6. Untitled0 http://127.0.0.1:8888/27ec8dbc-329f-4d46-87e9-5d085a... In [141]: def valeur(a, b): return a, b In [142]: x, y = valeur(20, 30) In [143]: print x 20 In [150]: class Point: def __init__(self, x, y): self._valeur= 30 self.x = x self.y = y In [148]: a = Point(20, 30) In [149]: a.x Out[149]: 20 In [151]: a = add In [152]: print a <function add at 0x96f7844> In [153]: a(3, 5) Out[153]: 8 In [153]: In [158]: a = 'UnE PhRase ExeMple' In [159]: a.capitalize() Out[159]: 'Une phrase exemple' In [160]: import string In [162]: string.printable Out[162]: '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&'()*+,-./:;<=>?@[]^_`{|}~ tnrx0bx0c' In [ ]: 6 of 6 13/01/2012 22:09