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


Groups > comp.lang.python > #67476 > unrolled thread

Re: Help with "Guess the number" script

Started byDennis Lee Bieber <wlfraed@ix.netcom.com>
First post2014-03-02 17:55 -0500
Last post2014-03-02 17:55 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#67476 — Re: Help with "Guess the number" script

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2014-03-02 17:55 -0500
SubjectRe: Help with "Guess the number" script
Message-ID<mailman.7600.1393800943.18130.python-list@python.org>
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/

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web