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.
In questa pagina del sito puoi guardare il video online Function in Python della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Nuruzzaman Faruqui 23 settembre 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 549 volte e gli è piaciuto 8 spettatori. Buona visione!