+ 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?

29th Nov 2018, 4:50 AM
D. Booey 📜
D. Booey 📜 - avatar
6 Respuestas
+ 4
29th Nov 2018, 1:13 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 2
try colored module
1st Dec 2018, 1:01 AM
Erhad
Erhad - avatar
+ 1
Erhad as in: import colored ?
1st Dec 2018, 1:34 AM
D. Booey 📜
D. Booey 📜 - avatar
1st Dec 2018, 1:36 AM
Erhad
Erhad - avatar
0
How to start competitive programming? I Am done with my c programming, what to do next?
30th Nov 2018, 9:15 PM
Adarsh jha
Adarsh jha - avatar
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..
4th Dec 2018, 1:05 AM
D. Booey 📜
D. Booey 📜 - avatar