Function in Python

Publié le: 23 septembre 2021
sur la chaîne: 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.


Sur cette page du site, vous pouvez voir la vidéo en ligne Function in Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Nuruzzaman Faruqui 23 septembre 2021, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 549 fois et il a aimé 8 téléspectateurs. Bon visionnage!