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 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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

1st Aug 2017, 6:56 AM
hassan
hassan - avatar
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.
1st Aug 2017, 7:33 AM
Vukašin Zeljić
Vukašin Zeljić - avatar
+ 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.
1st Aug 2017, 8:43 PM
Vukašin Zeljić
Vukašin Zeljić - avatar
+ 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?
2nd Aug 2017, 7:53 AM
Vukašin Zeljić
Vukašin Zeljić - avatar
+ 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.
2nd Aug 2017, 8:15 AM
Vukašin Zeljić
Vukašin Zeljić - avatar
+ 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.
2nd Aug 2017, 8:33 AM
Vukašin Zeljić
Vukašin Zeljić - avatar
+ 1
Are you using shell(looks like cmd, just plain white text on a black background) or IDLE(white background, different color text)
2nd Aug 2017, 8:04 AM
Vukašin Zeljić
Vukašin Zeljić - avatar
0
why?
1st Aug 2017, 6:56 AM
hassan
hassan - avatar
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???
1st Aug 2017, 1:41 PM
hassan
hassan - avatar
0
need more help please??
2nd Aug 2017, 7:50 AM
hassan
hassan - avatar
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.
2nd Aug 2017, 7:58 AM
hassan
hassan - avatar
0
idle (white background different colour text) yeah that one. am I using the wrong one?
2nd Aug 2017, 8:07 AM
hassan
hassan - avatar
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." '''
2nd Aug 2017, 8:23 AM
hassan
hassan - avatar