On Mar 1, 2014, at 9:35 AM, Dennis Lee Bieber <wlfr...@ix.netcom.com> wrote:
>       Without loops, one part of your assignment is going to be tedious,
> unless the intent is to only allow for one guess per run.
No, 10 guesses per game.  Yes very tedious and repetative.
> 
>> from random import randrange
>> randrange(1, 101)
> 
>       You generated a random number and then threw it away.
>> 
>> from random import seed
>> seed(129)
I do not know what seed is.  The directions in the begining said to do that I 
guess to test the code through out writing it?  This is what the directions for 
that part said.
At the top of your file, import the randrange function from the random module. 
In order to test this module I also want you to import the seed function from 
the random module. Immediately after importing it I want you to call the seed 
function with an argument of 129. By calling the seed function we ensure that 
the sequence of random numbers you generate will exactly match the ones used in 
this document. 

> 
>       Now you are seeding the random number generator but never generate a
> new number after it.
> 
>> 
>> def print_description():
>>   print """Welcome to Guess the Number.
>>   I have seleted a secret number in the range 1 ... 100.
>>   You must guess the number within 10 tries.
>>   I will tell you if you ar high or low, and
>>   I will tell you if you are hot or cold.\n"""
>> 
>> def get_guess(guess_number):
>>   print "(",guess_number,")""Plese enter a guess:"
>>   current_guess = raw_input()
>>   return int(guess_number)
> 
>       You're returning the counter of how many guesses have been made, and
> dropping the player's guess into the trash
I actually do not understand what you mean here.  Should I get rid of the 
current_guess line completely?  Should it look more like this;

def get_guess(guess_number):
        raw_input(“Please enter a guess”)
        guess_number = int(guess_number)
        return (guess_number)
get_guess(1)
> 
>> 
>> def main():
>>   print_description()
>>   secret = 50
> 
>       That's supposed to be the random number, isn't it?
Yes it is, I put 50 there because I was going to try and test it.  I think it 
should be secret = randrange(1,101) right?
> 
>>   current_guess = 1
>>   get_guess(1)
> 
>       You drop the return value into the trash
> 
>>   if current_guess != secret():
> 
>       You are /calling/ a function called secret -- which doesn't exist,
> since you bound it to the integer value 50; And current_guess doesn't exist
> in this function either.
> 
>>       print "Congratulations you win!!"
> 
> 
>       Read the documentation on how function calls and return values operate.
> Hint: you need to do something with the returned value /at the point where
> you call the function/.
Hmm, ok I’ll try and find what I’m missing.

> 
>       And -- as has been mentioned; these mistakes are better served in the
> tutor list, as they would be mistakes in /any/ common programming language.
> -- 
>       
Yes, I’m sorry I completely forgot.  I’ll repost there and go that route.  
Thanks though!


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to