Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #67476

Re: Help with "Guess the number" script

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Help with "Guess the number" script
Date 2014-03-02 17:55 -0500
Organization IISS Elusive Unicorn
References <43B63C46-3A2D-4374-8A42-EE931BA9A6C4@cox.net> <YGdh1n00C3bjUJS01GdiJ5> <D5517554-EB36-48D5-82BA-33247F11A4AE@cox.net>
Newsgroups comp.lang.python
Message-ID <mailman.7600.1393800943.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, 1 Mar 2014 18:06:09 -0700, Scott W Dunning <swdunning@cox.net>
declaimed the following:

>No, 10 guesses per game.  Yes very tedious and repetative.

	Based upon the other instructions, I suspect the first program is just
supposed to handle ONE guess, but is supposed to include the features
needed to eventually handle a loop with limit on how many guesses are
allowed.

>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.

	Seeding a random number generator is what sets the starting condition
of the generator. Using a constant seed means each time the program is run
it will create the same sequence of random numbers.

>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. 
>

	That means the instructor expects to be able to run the program and
/knows/ what the sequence of random numbers will be, so can confirm that a
success or failure guess is the correct one.

	Normally in seeding random number generator one will pick up something
that is not the same on each run: current clock time; difference between
time of keystrokes, etc.


>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)

	No... guess_number is supposed to be the count of which try/attempt
this is; you need to return what the user entered.

>Hmm, ok I’ll try and find what I’m missing.
>

	That is the best route -- the language reference isn't that large (and
if you skip the looping structures much shorter <G>
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Help with "Guess the number" script Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-03-02 17:55 -0500

csiph-web