Function in Python

Publicado em: 23 Setembro 2021
no canal de: Nuruzzaman Faruqui
549
8

In this lesson, I am going to teach you how to use the function in Python.
Functions are smaller reusable code blocks. It is like a container which contains the code to perform a specific task. Actually, we have been using functions since the beginning of this course. For example – print function, input function and so on. Each of these functions has a purpose. For a small program, we can get things done without functions. But, when we build large complex programs, we need to break our code into smaller reusable functions. And that's what I am going to show you in this lesson.

The Python code used in this lesson:

def total_cost(price, shipping, discount):
print(f"Total cost: ${price + shipping - discount}")


total_cost(shipping=5, discount=1, price=10)


def welcome(fist_name, last_name):
print(f"Hi {fist_name} {last_name}")


welcome("Nuruzzaman", "Faruqui")

‘You are free to copy, edit, use and distribute this code without crediting the author. Enjoy copyright-free content.’ – Nuruzzaman Faruqui.


Nesta página do site você pode assistir ao vídeo on-line Function in Python duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Nuruzzaman Faruqui 23 Setembro 2021, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 549 vezes e gostou 8 espectadores. Boa visualização!