+ 3

Whats wrong??????

When I run my code on IDLE its correct but on solo learn it gives an error! Please help me. import random guessesTaken =0 print ("Hello! What is your name? ") myName = input('Whats your name?") number = random.randint(1, 20) print ("Well, {}, I am thinking of a number between 1 and 20." .format(myName)) while (guessesTaken < 6): print ("Take a guess.") guess = int(input()) guessesTaken += 1 if guess < number: print ("Your guess is too low.") if guess > number: print ("Your guess is too high.") if guess == number: break if guess == number: guessesTaken = str(guessesTaken) print ("Good job, {} ! You guessed my number in {} guesses!" .format(myName, guessesTaken)) if guess != number: number = str(number) print ("Nope. The number I was thinking of was {}" .format(number))

31st Aug 2017, 6:44 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
16 odpowiedzi
+ 8
myName=input("What's your name?') Correct line 3 of ypur code. It's a careless mistake you made
31st Aug 2017, 7:03 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
Try to use a different code runner. Like IDLE, PyCharm.
31st Aug 2017, 7:47 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
line 5: myName = input('Whats your name?") # mismatch of quote types you use a single on the left and double on the right.
31st Aug 2017, 7:01 AM
ChaoticDawg
ChaoticDawg - avatar
+ 5
I will look into it
31st Aug 2017, 7:01 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 5
You need to enter all your inputs at once then click submit. name 1 2 3 4 5 6 click submit
31st Aug 2017, 8:36 AM
ChaoticDawg
ChaoticDawg - avatar
+ 4
i said its correct on idle but why is it wrong on SoloLearn
31st Aug 2017, 8:34 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 4
Sololearn doesn't allow multiple inputs
31st Aug 2017, 8:43 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
thanks
31st Aug 2017, 7:06 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 3
but it still gives an error in SoloLearn but not on my python
31st Aug 2017, 7:43 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 3
what should i do now
31st Aug 2017, 7:43 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 3
the error is Mohammad Mahdi Torabi: traceback (most recent call last): File "..\Playground\",line 9 in <module> guess = int (input()) EOFError: EOF when reading a line
31st Aug 2017, 8:33 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 3
you said i have to write them all at once its game and goes step by step you dont know whats the write guess and you need to get the help as if you should enter a smaller number or a bigger one
31st Aug 2017, 8:38 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 3
This is due to you not entering all the inputs at the same time. Your program can take up to 7 inputs. The name, and then up to 6 guesses (0-5). All of your inputs must be entered at the same time in the input popup field. See my previous post.
31st Aug 2017, 8:39 AM
ChaoticDawg
ChaoticDawg - avatar
+ 3
I dont know if you noticed that the playground works hen you use html and css and JS but it doesnt work as well for python
31st Aug 2017, 8:39 AM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar
+ 2
Yes, I understand that, but this is a limitation of the Sololearn code playground. It doesn't work like the code would running on a normal computer on the command line etc.
31st Aug 2017, 8:43 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
by the way thanks you can see rhe full project and play it on your own IDLE and then vote for me😀😀😀😀
31st Aug 2017, 8:25 PM
Mohammad Mahdi Torabi
Mohammad Mahdi Torabi - avatar