What does def do again? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What does def do again?

23rd Sep 2016, 10:08 PM
Ejah Frg
Ejah Frg - avatar
2 Answers
+ 4
def "def"ines the name of a new function. def add(x, y): <--- We're defining a function that adds two numbers together and naming it "add" return x+y <--- returns the value of our two numbers added together print(add(4, 7)) <--- asks our program to print the value returned by our function named "add"
24th Sep 2016, 12:00 AM
vyavas
+ 2
I had a hunch that was the case. Thanks very much. I appreciate it.
24th Sep 2016, 12:12 AM
Ejah Frg
Ejah Frg - avatar