¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
Problems with input function
Does anyone have problems with input function? The app don't run the code and don't show the out put when I use a string in the input function. Like, when I write n = input (), everything is ok, when I add n = input ("Enter your name") code doesn't run.
26 Respuestas
+ 10
Sololearn console is not a real console.
Input is only accepted once by the app, so getting multiple inputs needs some workaround.
And don't bother with input prompts
n = input("Your input instructions")
because they are displayed AFTER the input is submitted.
Just use
n = input()
and put instructions on comments at the beginning of your code so people would know what to type in.
It is weird, but maybe not exposing the console is a safety concern.
+ 5
The code works fine here in SoloLearn app.
+ 4
Code works for me. I just entered my name and it prints "Hello, Ipang"
Did you get any error message?
+ 4
Okay, I'm totally lost here cause I didn't have any problem when running it in SoloLearn (Android) app.
+ 4
Ok, I fix the problem with first one, it was in permission to the app.
+ 4
Oksana
I mean just LOL it off cause we all do silly things sometimes. It's part of learning 👌
+ 3
Oksana LOL 😁
+ 3
Ipang, yep😅 Newby🤷🏼♀️
+ 3
Every is working fine.
+ 2
Attach a link to the code in your thread Description for diagnostic purpose
https://www.sololearn.com/post/75089/?ref=app
+ 2
Hmm, i also have Android. Maybe that's because of security settings on popups. I'll try to check
+ 2
Same with me
+ 2
I found out that if you need several input, you write them in the code and when input prompt appears, you can write them in separate lines and it works.
+ 2
just don't put any text inside the input.
they are useless in Sololearn.
Place the instructions inside comments instead.
+ 2
Oksana K. You wrote: when I add n = input ("Enter your name") code doesn't run.
Try n = input(“Enter your name: “)
You need to leave a space after “Enter your name: and before the closing quotes“. That way it has room to enter input.
So instead of “abc”, you will have “abc “.
Hope that makes sense 😀
+ 2
The string in your input bracket will be displayed in line with the output not at time of input
+ 1
First it doesn't show the string that I wrote in brackets after input. Anyway I write my name, but then just nothing happens
+ 1
I've tried the same code on laptop and everything works. But in the app it doesn't