Python ver 3.9.4
msg = "I love learning to use Python."
print(msg)
Thank you, new to Python, kinda new to coding, sorry if i posted in wrong area
Python ver 3.9.4
msg = "I love learning to use Python."
print(msg)
Thank you, new to Python, kinda new to coding, sorry if i posted in wrong area
Iām not sure, because copy/pasting your code directly into the interactive prompt works just fine for me 
Rather than summarizing what went wrong as āa syntax errorā itās usually best to copy/paste exactly the code that you used and the error you got along with a description of how you ran the code so that others can see what you saw and give better help. Barring that, the best I can do here is ātry again, it ought to workā.
Welcome to Python :). You posted in exactly the right place.
Iām not sure, because copy/pasting your code directly into the
interactive prompt works just fine for me
Maybe the OP hand typed correct code into the forum
While reading by
eye from incorrect code ![]()
Rather than summarizing what went wrong as āa syntax errorā itās
usually best to copy/paste exactly the code that you used and the error
you got along with a description of how you ran the code so that others
can see what you saw and give better help. Barring that, the best I
can do here is ātry again, it ought to workā.
Aye. In particular, note that Python quotes are either ASCII double
quote " or ASCII single quote '. Sometimes people type some kind of
āsmart quoteā, cut/paste from an badly transcribed example. For example,
the Unicode open and close quotes (distinct characters) are not valid
Python quotes.
Cheers,
Cameron Simpson cs@cskk.id.au
Sometimes the Python interpreter gets confused about errors on the
previous line, and reports the syntax error in the next line:
# Python 3.9
>>> x = [1, 2, 3
... msg = "I love learning to use Python."
File "<stdin>", line 2
msg = "I love learning to use Python."
^
SyntaxError: invalid syntax
The actual error is the previous line, the x = line is missing a
closing bracket.
scott,
try putting everything into a main function. i tried this and it worked first try:
def main():
msg = (āi love learning to use pythonā)
print(msg)
return
main()
cameron, another noob here. i read your response to this post and you mention the interactive prompt. are you referring to the command line interpreter or is this something else?
cameron, another noob here. i read your response to this post and you
mention the interactive prompt. are you referring to the command line
interpreter or is this something else?
For me, the interpret invoked interactively from the command line.
Example:
CSS[~/hg/css-pypi(hg:pypi)]fleet2*> py3
Python 3.9.10 (main, Jan 15 2022, 11:48:15)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>>
In the above, CSS[~/hg/css-pypi(hg:pypi)]fleet2*> is my shell prompt,
which is what I mean if I say āthe command lineā. For commands like
ls, rsync, etc.
The string py3 above is me typing the command:
py3
which is a little shell script of my own to invoke my ācurrentā
preferred python, usually from a personal virtualenv. It ends up running
python3. With no arguments, thatās the Python 3 interactive mode:
Python 3.9.10 (main, Jan 15 2022, 11:48:15)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more
information.
>>>
The >>> above is the Python interactive prompt, where you can type
Python syntax. Thatās what I mean by āthe Python interactive promptā.
Cheers,
Cameron Simpson cs@cskk.id.au