📚 › Python: the friendliest first language
10. Functions
इस लेख का अनुवाद अपने आप होगा। अभी अंग्रेज़ी में दिखाया जा रहा है।
Define a function with def, a name and parameters. return sends a value back. Calling a function means writing its name with brackets.
Functions keep programs tidy: name a job once, reuse it everywhere.
उदाहरण देखें
def greet(name):
return f"Hello, {name}!"
print(greet("Karim"))
✍️ अब आपकी बारी
Write square(n) that returns n times n, then print square(9).