+ 1

Is def(): a function?????

7th Mar 2018, 8:48 PM
Mohammed Seidu
Mohammed Seidu - avatar
2 Answers
+ 3
As Jonathan said, the correct syntax for defining a function in python is: def function_name(): ... A function that sums two terms and returns that sum is: def my_sum(x, y): s = x + y return s And can be called as: ex_sum = my_sum(2, 3) Which of course lets ex_sum be equal to 5.
7th Mar 2018, 10:23 PM
Pedro Demingos
Pedro Demingos - avatar
+ 1
No, because you aren't defining def(). def def(): would be a function.
7th Mar 2018, 9:04 PM
Dread
Dread - avatar