Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #59276
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'else:': 0.03; 'elif': 0.05; 'odd': 0.07; 'preference': 0.07; 'subject:help': 0.08; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'west,': 0.09; 'itself.': 0.14; 'posted': 0.15; '")"': 0.16; '"enter': 0.16; 'adjacent': 0.16; 'concatenate': 0.16; 'east,': 0.16; 'hint:': 0.16; 'message-id:@4ax.com': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:python': 0.16; "python's": 0.19; 'command': 0.22; 'code,': 0.22; 'input': 0.22; 'print': 0.22; '"you': 0.24; 'url:home': 0.24; 'question': 0.24; 'compare': 0.26; 'skip:" 30': 0.26; 'post': 0.26; 'header:X -Complaints-To:1': 0.27; 'leave': 0.29; "doesn't": 0.30; 'locations': 0.30; 'subject:please': 0.30; 'code': 0.31; 'page.': 0.31; 'that.': 0.31; 'int,': 0.31; 'though.': 0.31; 'quite': 0.32; 'link.': 0.33; 'display': 0.35; 'charset:us-ascii': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'half': 0.37; 'received:76': 0.38; 'nov': 0.38; 'to:addr:python-list': 0.38; 'ability': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'new': 0.61; 'took': 0.61; 'email addr:gmail.com': 0.63; 'provide': 0.64; 'road': 0.65; 'world': 0.66; 'here': 0.66; 'prompt': 0.68; 'user,': 0.69; 'lack': 0.78; 'fare': 0.84; 'north,': 0.91; '2013': 0.98 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: Some python newb help please? |
| Date | Tue, 12 Nov 2013 20:49:34 -0500 |
| Organization | IISS Elusive Unicorn |
| References | <f9bcd68d-ac00-421a-ade5-5f5690861d25@googlegroups.com> <mailman.2490.1384294935.18130.python-list@python.org> <22894a10-1ffd-4671-94f4-962dfb56e4fd@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-76-249-20-110.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.2521.1384307390.18130.python-list@python.org> (permalink) |
| Lines | 62 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1384307390 news.xs4all.nl 15923 [2001:888:2000:d::a6]:43148 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:59276 |
Show key headers only | View raw
On Tue, 12 Nov 2013 14:27:37 -0800 (PST), lrwarren94@gmail.com declaimed
the following:
>
>I'm not quite sure what you mean by that. it was on that pastebin link. I'll post it again here though. it's no longer than half a page.
The preference here is that if you ask a question about code, you
provide the code IN the message -- you don't send us off to some site that
may or may not retain the code down the road (whereas the question posted
here may be archived forever)
>
>x = 0
>y = 0
>quitCommand = 0
>
>print "Welcome to the World of Textcraft!"
>print "----------------------------------"
>print ""
>
>while quitCommand != int(5):
5 IS an int, so why coerce it to itself.
> print "You are currently at (" + str(x) + ", " + str(y) + ")"
> print "Enter a command (1 = North, 2 = East, 3 = South, 4 = West, 5 = Exit):"
> if int(raw_input()) == 1:
> print "Moving north"
> y = y + 1
> elif int(raw_input()) == 2:
> print "Moving east"
> x = x + 1
> elif int(raw_input()) == 3:
> print "Moving south"
> y = y - 1
> elif int(raw_input()) == 4:
> print "Moving west"
> x = x - 1
> elif int(raw_input()) == 5:
> print "Dost thou leave so soon? Fare thee well!"
> quitCommand = 5
> else:
> print "I find your lack of reading comprehension skills disturbing."
>
Note that you ask for NEW input from the user on each if/elif. You want
to read ONE value from the user, and then compare THAT value on each
if/elif line.
HINT: raw_input() can display a prompt string... so
command = int(raw_input(
"Enter a command "
"(1 = North, 2 = East, 3 = South, 4 = West, 5 = Exit): "))
{Note: I took advantage of Python's ability to concatenate adjacent strings
-- that way the line doesn't wrap at odd locations in UseNet}
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Some python newb help please? lrwarren94@gmail.com - 2013-11-12 14:14 -0800
Re: Some python newb help please? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-12 22:21 +0000
Re: Some python newb help please? lrwarren94@gmail.com - 2013-11-12 14:27 -0800
Re: Some python newb help please? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-11-12 22:54 +0000
Re: Some python newb help please? MRAB <python@mrabarnett.plus.com> - 2013-11-12 22:56 +0000
Re: Some python newb help please? lrwarren94@gmail.com - 2013-11-12 15:04 -0800
Re: Some python newb help please? Chris Angelico <rosuav@gmail.com> - 2013-11-13 10:19 +1100
Re: Some python newb help please? Tim Chase <python.list@tim.thechases.com> - 2013-11-12 16:59 -0600
Re: Some python newb help please? Chris Angelico <rosuav@gmail.com> - 2013-11-13 09:58 +1100
Re: Some python newb help please? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-11-12 20:49 -0500
Re: Some python newb help please? John Strick <jstrickler@gmail.com> - 2013-11-12 14:49 -0800
Re: Some python newb help please? Denis McMahon <denismfmcmahon@gmail.com> - 2013-11-12 23:05 +0000
csiph-web