Lol, im starting to get the hang out of, onto the next hurdle, i looked up the
error and it says the data is none?
Traceback (most recent call last):
File "guess.py", line 34, in
main(random.randint(1, 10))
File "guess.py", line 27, in main
guess, tries = getguess(target, allowed)
T
lse:
return guess, tries
def main(target):
guess, tries = getguess(target, allowed)
if guess == target:
print(responseCorrect + '! You guessed my number in ' + tries + 'guesses!')
else:
print(goodbye + ' The number I was thinking of was '
Hi Terry & Dave,
Thanks for the suggestions. I am running Python 2.7 and when I tried the code
above it said def main(target) <- invalid syntax. I was told to use pexpect by
my professor which is why I started to use that for the tests. As for the test
suggestions, I will try to come up wit tho
tro)
# user_input = raw_input(request)
# print(responseHigh)
# print(request)
# user_input = raw_input(request)
# print(responseLow)
# user_input = raw_input(request)
# print(responseCorrect)
# print(goodbye)
if __name__ == '__main__':
main()
[/code]
Hey,
How do i go about coming up/coding tests for this program below. Not sure how
to even approach writing about 5 tests for it.
Initially I had this for the test but its not working well.
Test was name test_guess.py (Code Below)
[code]
from unittest import TestCase
import pexpect as pe
im
I modified the guess.py file but am unable to run it, how do I go about
writing tests for this.
import random
guessesTaken = 0
number = random.randint(1, 10)
intro = 'I have chosen a number from 1-10'
request = 'Guess a number: '
responseHigh = "That's too high."
responseLow = "That's too lo
The question was more like what tests should I be writing, fine if I remove the
pexpect test I tried the test_guess & test_guesstoolow and still unable to get
it to work. So if i Want to ask for a number and typed a number which is at
random indicated by the top of the code, how do I proceed on
Initially I was shown pexpect, leaving that there, Can i make up 5 tests? I
tried tests two different ways and no luck. What am I supposed to be writing up
when I do a test and is there a particular way I can/should be referencing it
back to its main file?
THis is what I have for the test_guess
Hello,
I am trying to write a few tests for a random input number game but not too
sure how to proceed on.
I am following the Python Game from http://inventwithpython.com/chapter4.html
Started the tests with a file test_guess.py
from unittest import TestCase
import pexpect as pe
import guess