Im getting syntax error while callig my function
I used tab before print and did not use any space before calling my function Im attaching the link tof the screenshot of my code
the Python IDLE works slightly different, you first need to declare/define the function
after declaring/defining the function press enter (and again if you have to) until you go from the
... back to
>>> then you call the function.
you can’t declare and call the function in one go in the IDLE
defined the function body, I pressed enter one more time.
Hi,Thanks for helping me resolve the error
I have been stuck at this since yesterday
One more question- Do I always have to press enter 2 times after defining my function for calling function
in the IDLE, yes.
you can only do one thing at a time in the IDLE
the IDLE isn’t designed to write whole scripts, if you have a
.py file/script you can simple do:
def example(): print('hello world') example()
I would still use a white line between definition and call, but that is purely for readability