+ 1
¿Why Can't I import random? [FIXED]
It shows: SyntaxError: invalid character in ...
19 odpowiedzi
+ 7
It's fixed. I had to rewrite the import random sentence because I copy-pasted it. Thanks!
+ 6
You probably have an invisible character somewhere appearing as whitespace. This is very common if you copied and pasted to the playground. Try deleting and re-adding the whitespaces manually.
+ 5
please show us your code, we can import random in sololearn:
https://code.sololearn.com/cD27z054XNcg
+ 5
ChaoticDawg it's happening to me too a lot of times when i copy paste the code from the browser. For small bits of code, your solution is reliable. But when the code is like a 100 line long, what to do? Is there any way to do this copy paste without the special characters insertion?
+ 4
I don't know of a way to copy without the invalid characters (unless copying from an IDE like the ones from Jetbrains), but ya a program could definitely be written to remove those invalid characters. Of course, it would need to be ran somewhere other than SL (mobile), because you can't copy from the output of the playground, at least on my device(s).
+ 3
Óscar Gutiérrez yeah true🙌 but just in case there's a way to copy them without those characters...
+ 3
ChaoticDawg unless it is ran in a Sololearn web code😁
+ 3
Rishi Yes, this is true. The old version of the web SL playground used to highlight where these invalid characters were (would see red dots or something where there should be a space etc). I don't think the current version does this anymore, but you could try it. 😉
+ 3
ANONYMOUS ohh okay that's already a function😅👍
+ 3
Shankar no you can't use pygame module on Sololearn as far as i know, you've to go with some other interpreter application
+ 2
It would be great a code to remove special insertion characters.
+ 2
Óscar Gutiérrez i don't know, i was asking that to ChaoticDawg
+ 2
Shankar which module do you want to install?
+ 1
Rishi Tell me...
+ 1
how can we install python modules in solo learn
+ 1
Rishi
I want to install pygame module
+ 1
Okkk
Thanks
0
Its because you haven't added python to path, install python again in your system with the help of YouTube and use pycharm community edition....