Python

367 views

Published on

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
367
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
18
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Python

  1. 1. Python Overview pt. 1 Ricardo Lapa Dani
  2. 2. Who am I? • Ricardo Lapa Dani • Pythonista since 2005 • Djangonaut • Developer at Horizonte/Globosat Rio de Janeiro – Brazil • Free software enthusiast
  3. 3. About python • Created by Guido Van Rossum 1991 • Free software / Open Source • Widely used worldwide • High-level script programming language • Multi paradigm (procedural, functional, object-oriented) • General purpose (web, science, games, gui, 3d, mobile, etc..) • Multi plataform (windows, linux, etc)
  4. 4. The ZEN of python • Beautiful is better than ugly • Explicit is better than implict • Simple is better than complex • Complex is better than complicated • Readability counts.
  5. 5. The python interpreter • Interactive interface to python » python ricardodani@MAC019214 Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 1 2 >>> 3*(7+2) 27 >>>
  6. 6. The python interpreter • IDLE in Windows
  7. 7. Running python programs • Unix % python filename.py • Windows C:Python> python.exe filename.py
  8. 8. Simple code sample
  9. 9. Language Characteristics
  10. 10. Types Integers: 10 20 -1 0 7 42 int(30) int(‘2’) Float: 1.2 -4.3 5.2 float(10) 5. Complex 5+7j -2+3j Strings ‘Ricardo’ “Ricardo” ‘’’Ricardo’’’ u’Ricardo’ Lists [1, 2, 4, 5, “Ricardo”, 1.2, [2, 4, 5]] Dictionaries {‘name’: Ricardo, ‘age’: 25, ‘friends_name’: [“Joaquim”, “Maria”]}
  11. 11. Comparation 1 == 2 False 1 == 1 True 1 in [1, 2, 4, 5] True not 1 in [1, 2, 4, 5] False “Lapa” in “Ricardo Lapa” True 1 > 2 False 1 <= 2 True 1 is (2 – 1) True 1 is True False
  12. 12. Logical operators Arithmetic Operators + - * / % ** // Comparasion Operators == != <> > < >= <= Logical and or not Assignment Operators = += -= *= /= %= **= //= Membership Operators in not in Identify Operators is is not
  13. 13. Condictional structures IF / ELSE / ELIF if <condition>: do something elif <another_condition>: do another something else: do something else
  14. 14. Repetition Structures For for <element> in <iterable>: iterate over each <element> of iterable While while <condition_is_true>: do something
  15. 15. Source • http://www.slideshare.net/amiable_indian/introduction-to-python • http://en.wikipedia.org/wiki/Python_(programming_language) • http://www.tutorialspoint.com/python/python_basic_operators.htm

×