Need help with solving syntax error in calling functon on python

Hi,
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

like so:

image

after I defined the function body, I pressed enter one more time.

3 Likes

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

2 Likes