Feb-20-2018, 06:51 PM
Hi,
I'm totally new to python programming. I've written a function that will return the square of a number. Below is the code for the same:
Please let me know the exact syntax for both the cases.
Thanks,
Arnab
I'm totally new to python programming. I've written a function that will return the square of a number. Below is the code for the same:
numcalls = 0 >>> def square(x): global numcalls numcalls = numcalls + 1 return x * x d = square(5)However getting the below error:
Error:SyntaxError: invalid syntax
I've also tried with the following code:numcalls = 0 >>> def square(x): global numcalls numcalls = numcalls + 1 return x * x print (square(5))but the same error persist.
Please let me know the exact syntax for both the cases.
Thanks,
Arnab