Python Forum
Python beginner: Weird Syntax Error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python beginner: Weird Syntax Error
#1
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]
Reply
#2
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?
I am trying to help you, really, even if it doesn't always seem that way
Reply
#3
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]
Reply
#4
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...ython-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
Reply
#5
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 :/
Reply
#6
(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.
I am trying to help you, really, even if it doesn't always seem that way
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Syntax error for "root = Tk()" dlwaddel 15 1,006 Jan-29-2024, 12:07 AM
Last Post: dlwaddel
Photo SYNTAX ERROR Yannko 3 333 Jan-19-2024, 01:20 PM
Last Post: rob101
  Syntax error while executing the Python code in Linux DivAsh 8 1,450 Jul-19-2023, 06:27 PM
Last Post: Lahearle
  Code is returning the incorrect values. syntax error 007sonic 6 1,134 Jun-19-2023, 03:35 AM
Last Post: 007sonic
  syntax error question - string mgallotti 5 1,248 Feb-03-2023, 05:10 PM
Last Post: mgallotti
  Weird behaviour using if statement in python 3.10.8 mikepy 23 3,422 Jan-18-2023, 04:51 PM
Last Post: mikepy
  Syntax error? I don't see it KenHorse 4 1,194 Jan-15-2023, 07:49 PM
Last Post: Gribouillis
  Syntax error tibbj001 2 847 Dec-05-2022, 06:38 PM
Last Post: deanhystad
  Python-for-Android:p4a: syntax error in main.py while compiling apk jttolleson 2 1,775 Sep-17-2022, 04:09 AM
Last Post: jttolleson
  Beginner Python Error ianmac88 4 1,280 Sep-05-2022, 12:30 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020