- 3
How to solve this problem:)?
If i run a code with e.g. "n=int(input("Enter sth:"))" it shows me the error "ValueError: invalid literal for int() with base 10 : ' ' "
9 odpowiedzi
+ 7
Ferhat Nazlioglu in sololearn you have to give all inputs in the pop-up that shows when you run the code. Your inputs and your code are then sent to a server to be executed.
To give multiple inputs you have to use multiple lines. Sololearn doesn't work with real interactivity.
+ 1
First i tried "n=float(input("Enter sth:"))"
And the code runs perfectly in other interpreter like you link:D so it is solo learn who fuvked up^^ thank you a lot:)
0
This is because "int" takes only strings that look like integers.
Your code works fine if you give "1" or "42" as input, but an error will be raised if you pass "42.0" as input.
If you want to use floats, use "float" instead of "int".
0
i tried that with "float" too but than the output is "...can't convert string to float". i also tried to run the code in another program and the code works so is the problem in solo learn somehow? yester day there was no problem with running the code with an input...
0
It should work, so there must be something wrong with your input. Can you please tell me what inputs did you use?
0
The Problem is i cant even put in sth:) after running it shows me this error...
0
So did you try:
n = float(input("Enter sth:"))
?
It's definitely an input error, so maybe something causes your machine to enter some input as soon as you execute the code.
Try running the code in this online Python interpreter and see if the error persists: https://www.programiz.com/python-programming/online-compiler/
0
Ferhat Nazlioglu
You are correct to assume that Sololearn does not process input the same way as an external IDE.
But you can place a prompt in Sololearn using the following format
n = int(input()) # input a number
0
Tried it and doesnt work...:( Rik Wittkopp