raw_input name error | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

raw_input name error

I posted my pythonslots code, but it won't run because it says raw_input has not been defined. I thought it was a standard library function. Do I need to do something special to make my code run in the code playground?

23rd Jun 2018, 7:00 AM
Kyler Louder
7 Answers
+ 6
in python3 raw_input() was renamed as input() so change raw_input() by just input()
23rd Jun 2018, 7:03 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 5
yes, playground have this unexpected way of taking input, pass all your inputs separated by single lines in the only prompt appear (total number of lines = no of times your code is expecting the input) example if your code is expecting 3 inputs, then input should be as follows: input1 input2 input3 I hope this solves your problem.
23rd Jun 2018, 7:27 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 5
nope there isn't in the playground.
23rd Jun 2018, 7:29 AM
Nikhil Dhama
Nikhil Dhama - avatar
+ 5
your welcome ☺️
23rd Jun 2018, 7:35 AM
Nikhil Dhama
Nikhil Dhama - avatar
0
changing raw_input() to input() got rid of the name error, but sololearn code playground doesn't seem to handle the input request very nicely. I have two lines containing input () and one of those is in a loop but it only prompts for input once when "Run" is pressed. Is this a limitation of sololearn? Or am I still doing something wrong? It's the only code I've posted if you wanna check it out.
23rd Jun 2018, 7:18 AM
Kyler Louder
0
so there is no way to handle infinite inputs, say for like a game?
23rd Jun 2018, 7:29 AM
Kyler Louder
0
Bummer. Thanks for your answers, though! Very helpful!
23rd Jun 2018, 7:32 AM
Kyler Louder