Python Forum
Python beginner: Weird Syntax Error - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python beginner: Weird Syntax Error (/thread-5596.html)



Python beginner: Weird Syntax Error - mentoly - Oct-12-2017

Hello to all.

I need a quick and easy fix for my problem with Python error.

I'm just beginning coding, and I'm a little bit frustrated because it seems like error is not in my code (which is pretty pretty simple) but in the Python version number?

I tried reinstalling, putting Python on another computer (same error on Windows 7 32-bit, Windows 10 64-bit, same problem).

Tried with web-based and exe versions, the problems still exists.

Please, anyone?

[Image: gS6uwWf.jpg]


RE: Python beginner: Weird Syntax Error - gruntfutuk - Oct-12-2017

I can't see why you get that error either. Code, looks fine. Usually, Python errors come with more detail, so I'm not convinced it is from CPython.

Have you tried putting the statements into to a file and executing that from PowerShell command line?

How come the 6 in Python 3.6.3 is highlighted in red?


RE: Python beginner: Weird Syntax Error - mentoly - Oct-12-2017

I don't know either. Number 6 goes red when I try to execute code with F5 in IDLE.

It doesn't work in cmd nor PS.

I'm totally confused.

[Image: 1gJaHOd]


RE: Python beginner: Weird Syntax Error - buran - Oct-12-2017

that is because you did copy/paste in your file zadatak_4.py everything from the python interactive prompt. that is wrong. read this https://python-forum.io/Thread-Basic-How-to-Execute-python-code

your file should have only this in it:
 
a = float(input("Unesite prvi broj:"))
b = float(input("Unesite drugi broj:"))
c = a + b
print(c)
everything else is from the python interactive prompt and should not be in the file. Then you can run it with F5


RE: Python beginner: Weird Syntax Error - mentoly - Oct-12-2017

Oh my god. You're totally right while I'm a little ashamed now :/

Thank you very much, and sorry for the images. Didn't know :/


RE: Python beginner: Weird Syntax Error - gruntfutuk - Oct-13-2017

(Oct-12-2017, 08:16 PM)mentoly Wrote: Oh my god. You're totally right while I'm a little ashamed now :/

Thank you very much, and sorry for the images. Didn't know :/
Ha ha.

You are not the only one feeling dumb, I didn't pick up what you were doing either. I've never used IDLE, so didn't realise you were not in the console.