Can you test this Python script please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can you test this Python script please.

https://code.sololearn.com/c8R55oNk4DZ1/?ref=app I posted this before leaving for work. Someone told me it returned an error. I believe I fixxed it but I am at work and cannot copy it back to my PC to make sure. Please test it for me. And not on the code playground. The script requires a lot of user input and that just really diesnt work out well on the playground. So paste it into IDLE or whatever you prefer. Thanks.

4th Jun 2017, 8:46 PM
Spock
Spock - avatar
6 Answers
+ 4
You have effectively a command wich is platform dependant, and could be more or less probematics depending on OS running your script ^^ I tested it on android tablet, and it print 'sh: cls: not found' instead of clear screen :P You should replace all: os.system("cls") ... by: print('\33[f\33[2J') ... wich do the same thing more crossplatform (some terminal/console should even not be compatible with ANSI escape sequence command, but less than those wich will be not compatible with the shell command 'cls' ^^
5th Jun 2017, 2:01 AM
visph
visph - avatar
+ 3
os.system() is a function from standard library so it's cross-platform, but it's purpose is to exit Python interpreter and execute a command of shell, which are independant from Python and totally dependant of shell executed ^^
5th Jun 2017, 6:26 AM
visph
visph - avatar
0
Hi Spock, I tested your code; to my knowledge, everything seems to look in tact. Good job, I liked the script you made. Keep it up!
4th Jun 2017, 11:25 PM
AlexLSD
AlexLSD - avatar
0
@AlexLSD awesome thank you.
4th Jun 2017, 11:41 PM
Spock
Spock - avatar
0
Seems to be working. Says I'm frisky_cat568
5th Jun 2017, 1:20 AM
Rex Nicodemus
Rex Nicodemus - avatar
0
@visph Well, I hadnt even considered that it might not be cross platform since I only used the standard library. Thanks for the excellent suggestion. I'll try to remember to start using that instead of "cls". Its always nice to learn easy solutions to big problems.
5th Jun 2017, 3:56 AM
Spock
Spock - avatar