Why?

Why this technology is relevant and what the scope.

Python is a general-purpose and high-level programming language. You can use Python for developing desktop GUI applications, websites, and web applications. Also, Python, as a high-level programming language, allows you to focus on the core functionality of the application by taking care of common programming tasks

Take-Away Skills

After following this resource what you will learn.

Syllabus

Summary of what learn to get started.

The content

Details about the technology and learning materials.

Python lambda

Syntax

lambda arguments: expression

The expression is executed and the result is returned:

x = lambda a : a + 10
print(x(5))
#15

Decorators

Decorators are very powerful and useful tool in Python since it allows programmers to modify the behaviour of function or class. Decorators allow us to wrap another function in order to extend the behavior of wrapped function, without permanently modifying it.

<aside> 💡 In Decorators, functions are taken as the argument into another function and then called inside the wrapper function.

</aside>

@gfg_decorator
def hello_decorator(): 
    print("Gfg") 
  
'''Above code is equivalent to - 
  
def hello_decorator(): 
    print("Gfg") 
      
hello_decorator = gfg_decorator(hello_decorator)'''

In the above code, gfg_decorator is a callable function, will add some code on the top of some another callable function, hello_decorator function and return the wrapper function.

Intro to Backend development and flask

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/52149980-52fd-42e7-b44e-cb6e7cae7e94/Screenshot_2019-10-12_at_12.30.49_AM.png

Major Backend Frameworks

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/c64d9f7c-0fa9-4e1c-9ed8-b1beb75ecb8a/Screenshot_2019-10-12_at_12.32.25_AM.png

Let's dive into code

from flask import Flask
app = Flask(__name__)

@app.route('/')
def helloworld():
		return "hello world"

if __name__ == "__main__":
		app.run()

Working

from flask import Flask
app = Flask(__name__)

The Flask constructor take name of the module as parameter.

@app.route('/')

The route function of the Flask class is a decorator which tells the application, which URL should call the associated function.

The function associated with the above route will be called by

http://192.168.0.192:5000/

@app.route('/hello')

This one by

http://192.168.0.192:5000/hello

@app.route('/')
def helloworld():
		return "hello world"

The function helloworld() is bounded by the URL /

So when the home page of the web browser is loaded, the output of helloworld() will be rendered.

if __name__ == "__main__":
		app.run()

Finally the run() method will run the web app in local development server.

<aside> 👶 Level: Advanced

</aside>

<aside> 💼 Career Path: ‣

</aside>

Top links

3.7.5rc1 Documentation

Automate the Boring Stuff with Python

Free courses

Free Python Tutorial - Introduction To Python Programming

Communities in Kerala

TinkerHub Foundation - Creating talents with emerging technology skills

Resource Persons

Navneet K T

Email

Gopi Krishnan

Email / Twitter