2. … is a widely used general-purpose, high-level
programming language - http://python.org
Python
3. The creator
Guido Van Rossum (1956 - …)
Employment: Google, Dropbox
“There is one way to do it right
...if you aren’t Dutchman”
4. The Zen of Python
Beautiful is better than ugly
Explicit is better than implicit
Simple is better than complex
Complex is better than complicated
Readability counts
5. Features
● dynamic type system
● automatic memory management
● large and comprehensive standard library
● lots of implementations
● beautiful, understandable, powerful syntax
● easy to learn
● TOP employers use it : Google, Yandex ...
6. Examples
print 'Hello, world!'
>>> Hello, world!
def fib(n):
if n < 2:
return n
return fib(n-2)+fib(n-1)
print fib(7)
>>> 13
a = 3
b = ‘hello’
print b * 3
>>> hellohellohello
7. Flask
Flask is a microframework for Python web-apps.
http://flask.pocoo.org/
created by Armin Ronacher
8. Flask based ‘Hello, world!’ app
1. Connect to a ‘flask’ wifi-hotspot from your
devices
2. Open your browser
3. Get to 192.168.xxx.xxx/
4. Have fun: get to 192.168.xxx.xxx/any text
e.g. 192.168.xxx.xxx/<h1>Hello, class<h1>
9. Explanation
flask.py
---------------------------------
from flask import Flask < import required modules
app = Flask(__name__) < create instance app of a class Flask
@app.route("/") < decorate method hello with app.route
def hello():
return "Hello World!"
@app.route("/<text>")
def hello_user(text):
return text
app.run(host=’0.0.0.0’) < call the run method on app