Python Forum

Full Version: If & Else statements not printing.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi fellow developers, so i just started coding with Python.

I am trying to print a " If or Else, statement " and is just not letting me print, telling me i did something wrong. Can't seem to figure it out.. Doh


score = 99
if score == 100:
 print ("Congrat, u reached 100")
 else:
 print("Almost at 100")
Print box:

Error:
Syntax:Error: Invalid syntax [Finished in 0.0s with exit code 1]
Forgive me if i am a noob Big Grin
Please, don't post images of code
Copy/paste your code in python tags
copy/paste full traceback, if you get one - in error tags

See BBcode help for more info.
I doubt indentation is erroring you, try below to see if that helps

score=99
if score == 100:
	print(f"congrats, you reached {score}\n")
else:
	print("Almost at 100\n")
Output:
python test1.py Almost at 100
Best Regards,
Sandeep

GANGA SANDEEP KUMAR
Thank you it worked.