Python identifies a collection of codes by indentation.
The f(x) function definition and the utilization part of the function are defined at the same level of indentation, so f(x) could not be executed.
Wouldn't it be better to write it down as follows?
def(x):
return x*2
result=f(2)
print(result)
© 2024 OneMinuteCode. All rights reserved.