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.
Auf dieser Seite können Sie das Online-Video Function in Python mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Nuruzzaman Faruqui 23 September 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 549 Mal angesehen und es wurde von 8 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!