Lesson 5 of 6
Functions
Group reusable logic into named functions.
Functions make programs easier to organize, test and reuse.
Python defines functions with the def keyword and can return values to the calling code.
Example
def greet(name):
return f"Hello, {name}!"
print(greet("Asha"))Practice challenge
Write a function that returns the square of a number.