+ 4
Is there a way to print a string in a different color using SoloLearn
Is there a way to print a string in a set text color in SoloLearn? For example, on my Linux machine, as well as my Android device (using Termux), I can use BASH and print "Hello World" on the screen in red text using: "echo -e" \033[31mHello World\033[m" Similarly, I can do the same with Python using: "print('\033[31mHello World')" But in SoloLearn, I get "[31mHello World" Anyone know what's up?
6 Antworten
+ 4
There is a package named colorama but it is unsupported here.
https://www.sololearn.com/discuss/190117/?ref=app
https://code.sololearn.com/csTae6tX7D4l/?ref=app
+ 2
try colored module
+ 1
Erhad as in:
import colored
?
+ 1
here it is https://pypi.org/project/colored/
0
How to start competitive programming?
I Am done with my c programming, what to do next?
0
Erhad sorry, you misunderstood. I have no problem printing out a string in whatever color on my computer, or even on my android phone via Python in the Termux terminal emulator app using "\033[3xm" (x, being 0-7, with 0 for black, 1 red, 2 green, etc)..
But that code doesn't work in SoloLearn. For instance, if I run:
"print('\033[32m','hi',\033[m')"
Instead of getting "hi" in green, I get:
"[32mhi[m"
Or something like that.
Also, I can't import the colored module in SoloLearn..