Lesson 21 of 34

Functions: നിങ്ങളുടെ സ്വന്തം Commands

8 min 25 XP

ഒരേ കോഡ് വീണ്ടും വീണ്ടും എഴുതുകയാണോ? അത് function ആക്കൂ. def-ൽ തുടങ്ങി, പിന്നെ പേര്, ( ), :, ഉള്ളിലെ കോഡ് indent ചെയ്യൂ.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

( )-നുള്ളിൽ parameters വെക്കൂ. Function call ചെയ്യുമ്പോൾ നൽകുന്ന values (arguments) അവയിൽ എത്തുന്നു.

Example: edit me and press Run

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.

Function define (def) ചെയ്താൽ അത് പ്രവർത്തിക്കില്ല. അത് call ചെയ്യണം: greet(...)

Challenge

+25 XP

"Vanakkam, <name>!" print ചെയ്യുന്ന greet(name) function എഴുതൂ. പിന്നെ greet("Arun"), greet("Priya") എന്നിവ call ചെയ്യൂ.

Output Loading Python (first time takes a few seconds)
Press Run to see the result here.