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


Groups > comp.lang.python > #67476

Re: Help with "Guess the number" script

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'importing': 0.05; 'allowed.': 0.07; 'directions': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'subject:script': 0.09; 'subject:Help': 0.11; 'random': 0.14; 'expects': 0.16; 'generator.': 0.16; 'is;': 0.16; 'i\xe2\x80\x99m': 0.16; 'looping': 0.16; 'message- id:@4ax.com': 0.16; 'no...': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'run:': 0.16; 'said.': 0.16; 'sat,': 0.16; 'language': 0.16; 'module': 0.19; 'file,': 0.19; 'normally': 0.19; 'import': 0.22; 'rid': 0.24; 'skip': 0.24; 'url:home': 0.24; 'header:X-Complaints-To:1': 0.27; 'function': 0.29; 'correct': 0.29; 'document.': 0.30; 'sets': 0.30; 'code': 0.31; '-0700,': 0.31; 'clock': 0.31; 'constant': 0.31; 'time;': 0.31; 'supposed': 0.32; 'run': 0.32; 'guess': 0.33; 'subject:the': 0.34; 'subject:with': 0.35; 'something': 0.35; 'test': 0.35; 'but': 0.35; 'module.': 0.36; 'sequence': 0.36; 'shorter': 0.36; 'should': 0.36; 'starting': 0.37; 'handle': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'subject:" ': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'ensure': 0.60; 'eventually': 0.60; 'is.': 0.60; 'numbers': 0.61; 'success': 0.61; 'first': 0.61; 'confirm': 0.64; 'pick': 0.64; 'more': 0.64; 'between': 0.67; 'mar': 0.68; 'yes': 0.68; 'limit': 0.70; '8bit%:16': 0.84; 'i\xe2\x80\x99ll': 0.84; 'missing.': 0.84; 'route': 0.84; 'this;': 0.91; 'received:108': 0.93; 'scott': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Help with "Guess the number" script
Date Sun, 02 Mar 2014 17:55:28 -0500
Organization IISS Elusive Unicorn
References <43B63C46-3A2D-4374-8A42-EE931BA9A6C4@cox.net> <YGdh1n00C3bjUJS01GdiJ5> <D5517554-EB36-48D5-82BA-33247F11A4AE@cox.net>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host adsl-108-79-219-21.dsl.klmzmi.sbcglobal.net
X-Newsreader Forte Agent 6.00/32.1186
X-No-Archive YES
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.7600.1393800943.18130.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1393800943 news.xs4all.nl 2890 [2001:888:2000:d::a6]:44148
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:67476

Show key headers only | 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