25 Answers
New Answer25 Answers
New AnswerRemember that input is always string in Python. You need to convert it to a numerical type (int or float).
Every input is a string by default. You need to convert it to an integer to have a number by using int(). x = input() print(type(x)) # -> str x = int(input()) print(type(x)) # -> int
Remember that the code requires interaction which doesn't really work on sololearn. On sololearn you have to give all inputs before running.
Use guess = int(input()) to convert the input to integer. Use guess = float(input()) to convert the input to a floating point number. The comparison operator ">" cannot be used between a string and a numerical value.
Okay, so how do i make the number not change every time you guess? Simon Sauter ravilnicki
Or a for loop. Both are possible. If you want the player to guess until they get it right use a while loop. If you want a fixed number of guesses you can use either a while loop or a for loop.
Yea, am pretty newand am not really getting what your saying it probably be better in an example you used so i can understand more Simon Sauter
Okay now its saying something bout an indention block https://code.sololearn.com/cAwCU1WrQLIw/?ref=app
It should work in offline IDEs. Some online editors like sololearn require you to give all input upfront so it can be sent to a server together with the code where it is executed. If you're on android you can use pydroid3 as offline IDE. On PC you have lots of options.
You make everything right. But one notice: when you use input(), you ask somebody to input something in your program. Now it is not obvious... In input possible to write some text for user above somebody said that sololearn works not good with inputs. But in other platform you should write int(input("please, input integer number to find out wheather it odd or even")) this hint helps user to understand what to do.
It depends on input. Input is even than print if statement. Input is odd than print else statement.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message