0
Am using python 3.6.2 she'll. I try to put these codes where they say try it yourself but it giveing me SYNTAX ERROR AND TYPEERR
12 Answers
+ 3
Do you click on the "try it yourself" button? Sololearn shows the most important parts of the codes, but you need to click on the "try it yourself" button and it'll show the full code, where you can also press run to try it instantly,or you can copy it to IDLE or similar programs to run it.
+ 3
Well, if you're sure you copied the WHOLE code, there should be no problem and the code works for me both in code playground and IDLE. I'm not sure what the cause of your problem might be. Have you tried reinstalling IDLE? I don't know anything else that could be the solution, other than that.
+ 2
I don't know what else could be the problem. Do any of the codes you try work, or is it just one code? How many codes have you tried?
+ 2
No, you're using the right one. The "multiple statements found..." error would occur when you try to run multiple statements at a single time, which would be possible if you were using shell, however I don't know how this occurs in IDLE. Can you just reply with one of the codes that don't work? Maybe then I'll be able to see what's wrong.
+ 2
Which part exactly doesn't work? If you just copy and paste that WHOLE thing into IDLE, it won't work because of the lines such as "Quote from Stack Overflow" or "Example of docstring", which the program tries to do something with, but can't.
+ 1
Are you using shell(looks like cmd, just plain white text on a black background) or IDLE(white background, different color text)
0
why?
0
forget solo learn code playground. on the real idle programming for python on windows. it sometimes gives errors while in d
solo learn runs normal. WHY???
0
need more help please??
0
many. those I created my self work. but those I copied from code playground to idle. have this kind of errors
..syntaxerror
...multiple statements found while compiling a single statement.
0
idle (white background different colour text) yeah that one. am I using the wrong one?
0
''
6.19.2017 by Kryptic
Multiline comments explained.
Feel free to copy, use, edit this code anyway you want!
'''
print('The only way to make a comment in Python is with the octothorpe symbol, #\n') #or is it?
print('In Python 3 there is no general purpose way to comment-out multiline code.\n') #but you can multiline comments!
print('If you use the """ syntax below the first line of a function the section in-between the 6 double quotes(") becomes a Docstring which does generate bytecode at runtime.\n')
print("But if you use ''' or "+'"""' + ' anywhere, EXCEPT below the first line of a function, it is then treated like a comment and does NOT generate bytecode at runtime!' + '\n\nExamples below in code(commented-out)')
'''
Example of docstring
def eat(things):
"""
I'm saying stuff
One line below a function
And that makes me a docsting
"""
Example of a non docstring (no bytecode and acts as a # comment but on multiple lines)
"""
I'm saying stuff
And I'm NOT 1 line below a function!
So I'm treated like a comment!
"""
def eat(things):
Sources:
Quote from Python tut in SL
"Python doesn't have general purpose multiline comments, as do programming languages such as C."
Quote from Stack Overflow
"Python does have a multiline string/comment syntax in the sense that unless used as docstrings, multiline strings generate no bytecode -- just like #-prepended comments. In effect, it acts exactly like a comment."
'''