On 12/10/2016 11:15, Peter Otten wrote:
BartC wrote:
On 12/10/2016 05:30, Lawrence D’Oliveiro wrote:
On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote:
while n>=x:
n=n-1
print "*"* n
else:
print ("2nd loop exit n=",n,"x=",x)
What is the difference between that
BartC wrote:
> On 12/10/2016 05:30, Lawrence D’Oliveiro wrote:
>> On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote:
>>> while n>=x:
>>> n=n-1
>>> print "*"* n
>>> else:
>>> print ("2nd loop exit n=",n,"x=",x)
>>
>> What is the difference between that and
>>
>> w
On 12/10/2016 05:30, Lawrence D’Oliveiro wrote:
On Wednesday, October 12, 2016 at 11:23:48 AM UTC+13, BartC wrote:
while n>=x:
n=n-1
print "*"* n
else:
print ("2nd loop exit n=",n,"x=",x)
What is the difference between that and
while n>=x:
n=n-1
print "*"*
On 11/10/2016 22:26, Lawrence D’Oliveiro wrote:
On Wednesday, October 12, 2016 at 6:58:46 AM UTC+13, dhawan...@gmail.com wrote:
Only first loop is executing not the second one?
n=6
x=1
while x<=n:
print("*"*x)
x+=1
print('n=', n)
dhawanpawa...@gmail.com writes:
> n=6
> x=1
> while x<=n:
> print "*"*x
> x+=1
> while n>=x:
> n=n-1
> print "*"* n
>
>
> Only first loop is executing not the second one?
It's a basic fact about while loops that after the loop the condition is
false. The two conditions x <= n a
On 10/11/2016 11:58 AM, dhawanpawa...@gmail.com wrote:
>
> n=6
> x=1
> while x<=n:
> print "*"*x
> x+=1
> while n>=x:
> n=n-1
> print "*"* n
>
>
> Only first loop is executing not the second one?
Did you try printing out the loop variable to see what it does and what
it is aft
On Tue, Oct 11, 2016 at 1:58 PM, wrote:
>
> n=6
> x=1
> while x<=n:
> print "*"*x
> x+=1
> while n>=x:
> n=n-1
> print "*"* n
>
>
> Only first loop is executing not the second one?
Because after the first loop n < x
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Oct 15, 2014 at 10:04 AM, giacomo boffi wrote:
> Tim Chase writes:
>
>> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>>> is equivalent with
>>>
>>> while ans.lower()[0] != 'y':
>>> ans = input('Do you like python?')
>>
>> And still better improved with
>>
>> while ans[:1].low
Tim Chase writes:
> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>> is equivalent with
>>
>> while ans.lower()[0] != 'y':
>> ans = input('Do you like python?')
>
> And still better improved with
>
> while ans[:1].lower() != 'y':
> ans = input('Do you like python?')
yok is Turk
On 10/13/2014 11:12 AM, Rustom Mody wrote:
> On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote:
>> On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
>> Rustom Mody wrote:
>
>>> On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
On Mon, 13 Oct 2014 09:56:02 +1100
St
On Monday, October 13, 2014 10:13:20 PM UTC+5:30, Rob Gaddi wrote:
> On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
> Rustom Mody wrote:
> > On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> > > On Mon, 13 Oct 2014 09:56:02 +1100
> > > Steven D'Aprano wrote:
> > > > When you have mul
On Mon, 13 Oct 2014 09:26:57 -0700 (PDT)
Rustom Mody wrote:
> On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> > On Mon, 13 Oct 2014 09:56:02 +1100
> > Steven D'Aprano wrote:
> > > When you have multiple clauses in the condition, it's easier to reason
> > > about
> > > them i
On Monday, October 13, 2014 9:43:03 PM UTC+5:30, Rob Gaddi wrote:
> On Mon, 13 Oct 2014 09:56:02 +1100
> Steven D'Aprano wrote:
> > When you have multiple clauses in the condition, it's easier to reason about
> > them if you write the clauses as positive statements rather than negative
> > stateme
On Mon, 13 Oct 2014 09:56:02 +1100
Steven D'Aprano wrote:
>
> When you have multiple clauses in the condition, it's easier to reason about
> them if you write the clauses as positive statements rather than negative
> statements, that is, "something is true" rather than "something is not
> true",
On Mon, Oct 13, 2014 at 11:09 PM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> Or, even simpler: Use an active condition.
>>
>> while input('Do you like python?') not in ('yes', 'y'): pass
>
> Instead of the traditional "pull" technology, you could take advantage
> of the state-of-the-art "push"
On Mon, Oct 13, 2014 at 11:10 PM, Skip Montanaro
wrote:
> On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico wrote:
>>
>> while input('Do you like python?') not in ('yes', 'y'): pass
>
>
> Unfortunately, you probably have to account for people who SHOUT:
>
> while input('Do you like python?').lo
On Mon, Oct 13, 2014 at 6:59 AM, Chris Angelico wrote:
> while input('Do you like python?') not in ('yes', 'y'): pass
Unfortunately, you probably have to account for people who SHOUT:
while input('Do you like python?').lower() not in ('yes', 'y'): pass
Skip
--
https://mail.python.org/m
Chris Angelico :
> Or, even simpler: Use an active condition.
>
> while input('Do you like python?') not in ('yes', 'y'): pass
Instead of the traditional "pull" technology, you could take advantage
of the state-of-the-art "push" approach:
print("You must love python -- everybody does!")
Mar
On Mon, Oct 13, 2014 at 7:31 PM, Gelonida N wrote:
> Taking into account the Steven's suggestion about using the 'in' expression
> it could be:
>
>
> while True:
> ans = input('Do you like python?')
> if ans.lower() in ('yes', 'y'):
> break
Or, even simpler: Use an active conditio
On 10/12/2014 07:08 PM, Shiva wrote:
while ans.lower() != 'yes' or ans.lower()[0] != 'y':
ans = input('Do you like python?')
I personally consider double negations less intuitive than following:
while not( ans.lower() == 'yes' and ans.lower()[0] == 'y' ):
Reading this line yoy would ha
On Mon, Oct 13, 2014 at 11:43 AM, Dennis Lee Bieber
wrote:
> ONE: Python uses short circuit evaluation: for an OR, the second
> clause
> is only looked at if the first clause is FALSE (for an AND, the first
> clause has to be TRUE before the second is evaluated).
Short-circuiting doesn't
Tim Chase wrote:
> On 2014-10-12 22:16, Marko Rauhamaa wrote:
>> is equivalent with
>>
>> while ans.lower()[0] != 'y':
>> ans = input('Do you like python?')
>
> And still better improved with
>
> while ans[:1].lower() != 'y':
> ans = input('Do you like python?')
The intenti
On 2014-10-12 22:16, Marko Rauhamaa wrote:
> is equivalent with
>
> while ans.lower()[0] != 'y':
> ans = input('Do you like python?')
And still better improved with
while ans[:1].lower() != 'y':
ans = input('Do you like python?')
in the event that len(ans)==0 (a situation whi
On Sun, 12 Oct 2014 17:08:00 +, Shiva wrote:
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
while ans.lower() is not equal to "yes"
or ans.lower()[0] is not equal to "y"
the loop will continue to run
Note that if ans.lower() == 'y', then the first clause ( ans.lower() !=
'yes' )
On Mon, Oct 13, 2014 at 6:16 AM, Marko Rauhamaa wrote:
> The corrected version
>
> while ans.lower() != 'yes' and ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
> is equivalent with
>
> while ans.lower()[0] != 'y':
It's true that the first part is redundant, but tr
Chris Angelico :
> On Mon, Oct 13, 2014 at 4:59 AM, Shiva
> wrote:
>> Bit confusing to use in While loop - Should have used the 'and' condition
>> instead of OR- then it works fine.
>> for OR both condition need to be false to produce a false output and break
>> the loop.
>
> Correct, what you're
On Mon, Oct 13, 2014 at 4:59 AM, Shiva
wrote:
> Bit confusing to use in While loop - Should have used the 'and' condition
> instead of OR- then it works fine.
> for OR both condition need to be false to produce a false output and break
> the loop.
Correct, what you're looking for here is indeed a
Bit confusing to use in While loop - Should have used the 'and' condition
instead of OR- then it works fine.
for OR both condition need to be false to produce a false output and break
the loop.
More of SET operations.
Thanks,
Shiva
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Oct 13, 2014 at 4:21 AM, Shiva
wrote:
>> The loop will continue while either part is true - that's what "or"
>> means. Is that what you intended it to be doing?
>>
>> ChrisA
>>
>
>
> Yes..however, the second part of the or condition doesn't get evaluated.
> So if I enter a 'y' - I expe
In article ,
Shiva wrote:
> Why is the second part of while condition not being checked?
>
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
>
> My intention is if either of the conditions are true the loop should break.
> But the condition aft
> The loop will continue while either part is true - that's what "or"
> means. Is that what you intended it to be doing?
>
> ChrisA
>
Yes..however, the second part of the or condition doesn't get evaluated.
So if I enter a 'y' - I expect the second part to evaluate and the loop to
break -
On Mon, Oct 13, 2014 at 4:08 AM, Shiva
wrote:
> Why is the second part of while condition not being checked?
>
> while ans.lower() != 'yes' or ans.lower()[0] != 'y':
> ans = input('Do you like python?')
>
>
> My intention is if either of the conditions are true the loop should break.
> But th
On 04/09/2013 11:44 PM, Larry Hudson wrote:
On 04/09/2013 09:49 AM, thomasancill...@gmail.com wrote:
So what would be the proper way to perform a loop of this program. I still
can't quite figure
out the best way to do it.
My suggestion... (pseudocode)
# Print a heading/introduction here
w
On Apr 9, 8:47 pm, thomasancill...@gmail.com wrote:
> ... and if you have any ideas for me to improve my coding that will prevent
> me from learning
> python in a sloppy way. I'd like to learn it correctly the first time!
Not perhaps a direct answer...
Anyways there is style in which python is b
On 04/09/2013 09:49 AM, thomasancill...@gmail.com wrote:
So what would be the proper way to perform a loop of this program. I still
can't quite figure out the best way to do it.
My suggestion... (pseudocode)
# Print a heading/introduction here
while True:
# Print menu, with an added
On Wed, Apr 10, 2013 at 6:59 AM, Walter Hurry wrote:
> On Tue, 09 Apr 2013 16:12:34 -0400, Dave Angel wrote:
>
>> On 04/09/2013 03:35 PM, Walter Hurry wrote:
>>> On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
>>>
On Wed, Apr 10, 2013 at 1:47 AM, wrote:
> ... I'm not sure what
On Tue, 09 Apr 2013 16:12:34 -0400, Dave Angel wrote:
> On 04/09/2013 03:35 PM, Walter Hurry wrote:
>> On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
>>
>>> On Wed, Apr 10, 2013 at 1:47 AM, wrote:
... I'm not sure what version I'm using ...
>>>
>>> Try putting these lines into a
On 04/09/2013 03:35 PM, Walter Hurry wrote:
On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
On Wed, Apr 10, 2013 at 1:47 AM, wrote:
... I'm not sure what version I'm using ...
Try putting these lines into a Python script:
import sys
print(sys.version)
That works (of course), b
On Wed, 10 Apr 2013 02:10:29 +1000, Chris Angelico wrote:
> On Wed, Apr 10, 2013 at 1:47 AM, wrote:
>> ... I'm not sure what version I'm using ...
>
> Try putting these lines into a Python script:
>
> import sys
> print(sys.version)
>
That works (of course), but in every Python version I've s
On 9 avr, 15:32, thomasancill...@gmail.com wrote:
> I'm new to learning python and creating a basic program to convert units of
> measurement which I will eventually expand upon but im trying to figure out
> how to loop the entire program. When I insert a while loop it only loops the
> first 2 l
On 04/09/2013 01:18 PM, thomasancill...@gmail.com wrote:
sorry i just started using google groups, not really all that sure how to use
it properly.
IMHO, best way is to switch to a good email program, and mail your
messages to comp.lang.python. That's after subscribing via
http://mail.
On 04/09/2013 12:57 PM, thomasancill...@gmail.com wrote:
I responded before I saw this message, this was very helpful so I appreciate
your quick and helpful responses. So do you think prompting for a string and
then checking if the string is true is a good practice for something like this?
Whe
On Wed, Apr 10, 2013 at 3:18 AM, wrote:
> sorry i just started using google groups, not really all that sure how to use
> it properly.
The best way to use Google Groups is to not use it, frankly. Just
subscribe to the mailing list in gmail; it has its own issues (eg it
encourages top-posting by
sorry i just started using google groups, not really all that sure how to use
it properly.
--
http://mail.python.org/mailman/listinfo/python-list
On 04/09/2013 09:57 AM, thomasancill...@gmail.com wrote:
On Tuesday, April 9, 2013 9:32:18 AM UTC-4, thomasa...@gmail.com wrote:
I'm new to learning python and creating a basic program to convert units of
measurement which I will eventually expand upon but im trying to figure out how
to loop t
On Wed, Apr 10, 2013 at 2:57 AM, wrote:
> I responded before I saw this message, this was very helpful so I appreciate
> your quick and helpful responses. So do you think prompting for a string and
> then checking if the string is true is a good practice for something like
> this? When would c
I responded before I saw this message, this was very helpful so I appreciate
your quick and helpful responses. So do you think prompting for a string and
then checking if the string is true is a good practice for something like this?
When would checking for true/false be necessary?
--
http://ma
So what would be the proper way to perform a loop of this program. I still
can't quite figure out the best way to do it.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Apr 10, 2013 at 2:24 AM, wrote:
> For system version I get this:
> 2.7.2 (default, Oct 11 2012, 20:14:37)
> [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
Lovely! Perfect.
> But, what I don't understand exactly is the while statement. I've been
> looking around a lo
On Tue, Apr 9, 2013 at 12:24 PM, wrote:
> For system version I get this:
> 2.7.2 (default, Oct 11 2012, 20:14:37)
> [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
>
> Also, I understand what your saying about the continuation code. There's
> no need for me to include it in eac
For system version I get this:
2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
Also, I understand what your saying about the continuation code. There's no
need for me to include it in each if/else statement, I could just use it at the
en
On Wed, Apr 10, 2013 at 1:47 AM, wrote:
> ... I'm not sure what version I'm using ...
Try putting these lines into a Python script:
import sys
print(sys.version)
That, on any version of Python (back a fairly long way, Steven
D'Aprano can probably say how far), will give you a line or so of
out
On Tue, Apr 9, 2013 at 11:47 AM, wrote:
> Sorry I'm just starting to learn python and I'm not sure what version I'm
> using to be quite honest. I just started typing it up in Komodo edit (Which
> I'm not personally a fan in particular) I fixed the missing parenthesis
> which fixed the invalid syn
Sorry I'm just starting to learn python and I'm not sure what version I'm using
to be quite honest. I just started typing it up in Komodo edit (Which I'm not
personally a fan in particular) I fixed the missing parenthesis which fixed the
invalid syntax problem. Also, I apologize for submitting c
On Tue, Apr 9, 2013 at 11:58 PM, wrote:
> Also I'm getting a invalid syntax next to my elif statements that i wasnt
> getting before. why is this happening now?
Ah! That's relating to the close parenthesis problem I mentioned.
That's the exact issue I saw.
When you get told about a problem, so
On Tue, Apr 9, 2013 at 11:32 PM, wrote:
> I'm new to learning python and creating a basic program to convert units of
> measurement which I will eventually expand upon but im trying to figure out
> how to loop the entire program. When I insert a while loop it only loops the
> first 2 lines. Ca
Also I'm getting a invalid syntax next to my elif statements that i wasnt
getting before. why is this happening now?
--
http://mail.python.org/mailman/listinfo/python-list
On Tuesday, April 9, 2013 9:32:18 AM UTC-4, thomasa...@gmail.com wrote:
> I'm new to learning python and creating a basic program to convert units of
> measurement which I will eventually expand upon but im trying to figure out
> how to loop the entire program. When I insert a while loop it only
Ulrich Eckhardt wrote:
so why not:
while as :
...
and also:
if as :
...
This sort of thing has been suggested repeatedly in the
past, and it's always been rejected. That's not likely to
change. Look up the past threads for the reasons why.
--
Greg
--
http://mail.python.or
Peter Otten wrote:
> Duncan Booth wrote:
>> for rq in incoming_requests(...):
>>handle_request(rq)
>
> ...and a likely implementation would be
>
> def incoming_requests(...):
> while True:
> rq = ... # inlined version of get_request()
> if not rq:
> break
>
Duncan Booth wrote:
> Peter Otten <__pete...@web.de> wrote:
>
>> Ulrich Eckhardt wrote:
>>
>>> I'm looking for a way to write code similar to this C code:
>>>
>>> while(rq = get_request(..)) {
>>> handle_request(rq);
>>> }
>>>
>> Assuming get_request(...) is called with the same argum
Peter Otten <__pete...@web.de> wrote:
> Ulrich Eckhardt wrote:
>
>> I'm looking for a way to write code similar to this C code:
>>
>> while(rq = get_request(..)) {
>> handle_request(rq);
>> }
>>
> Assuming get_request(...) is called with the same arguments on each
> iteration and uses
Ulrich Eckhardt wrote:
> I'm looking for a way to write code similar to this C code:
>
> while(rq = get_request(..)) {
> handle_request(rq);
> }
>
> Currently I'm doing
>
> while True:
> rq = get_request(...)
> if not rq:
> break
> handle_request(rq)
>
>
Ulrich Eckhardt wrote:
> Hi!
>
> I'm looking for a way to write code similar to this C code:
>
> while(rq = get_request(..)) {
> handle_request(rq);
> }
>
> Currently I'm doing
>
> while True:
> rq = get_request(...)
> if not rq:
> break
> handle_request(rq)
Fab86 writes:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>> Fab86 wrote:
>> > Is it possible to get the program to catch the exception, wait 10
>> > seconds, then carry of from where it was rather than starting again?
>>
>> something like this? probably works in PASCAL as well :)
>>
>> > i=0
>> >
On Mar 5, 5:49 pm, Fab86 wrote:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>
>
>
> > Fab86 wrote:
> > > Is it possible to get the program to catch the exception, wait 10
> > > seconds, then carry of from where it was rather than starting again?
>
> > something like this? probably works in PASCAL a
On Thu, Mar 5, 2009 at 9:49 AM, Fab86 wrote:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>> Fab86 wrote:
>> > Is it possible to get the program to catch the exception, wait 10
>> > seconds, then carry of from where it was rather than starting again?
> using sleep and then continue just makes the s
On Thu, Mar 5, 2009 at 6:49 PM, Fab86 wrote:
> On Mar 5, 5:23 pm, Marco Mariani wrote:
>> Fab86 wrote:
>> > Is it possible to get the program to catch the exception, wait 10
>> > seconds, then carry of from where it was rather than starting again?
>>
>> something like this? probably works in PASC
On Mar 5, 5:23 pm, Marco Mariani wrote:
> Fab86 wrote:
> > Is it possible to get the program to catch the exception, wait 10
> > seconds, then carry of from where it was rather than starting again?
>
> something like this? probably works in PASCAL as well :)
>
> > i=0
> > while i < len(stuff):
> >
Fab86 wrote:
Is it possible to get the program to catch the exception, wait 10
seconds, then carry of from where it was rather than starting again?
something like this? probably works in PASCAL as well :)
i=0
while i < len(stuff):
try:
do_with(stuff[i])
except SomeError:
s
Hi,
Fab86 wrote:
Hello,
I am currently working on my program which send queries to Yahoo and
then saves them into a flatfile. The problem I have is that I need to
conduct 200 searches and Yahoo typically times out during the search
with an error. I have caught the error and told it to time.slee
On Wed, 28 May 2008 19:56:55 +0200, huub wrote:
> Being a newbie with Python, I'm trying a short program with this:
>
> > <..>
>> t = RoboInterface()
> > <..>
>> while not t.Digital(1): # while endpoint is not reached
>> 15 pass
>
> However, it always hangs on the 'while', which I can
2007-01-25 11:26:09
[EMAIL PROTECTED] wrote in message
<[EMAIL PROTECTED]>
> Hmm, my while loop with "or" doesn't seem to work as I want it to...
> How do I tell the while loop to only accept "Y" or "y" or "N" or
"n"
> input from the str(raw_input)?
>
> Thank's in advance!
>
> Snippet of code:
[EMAIL PROTECTED] a écrit :
>
> On Jan 25, 11:26 am, [EMAIL PROTECTED] wrote:
(snip)
>> #Runs the buildfinder function
>> usrinp = buildfinder()
>>
>> def buildwhiler():
>>
>> while usrinp != "y" or "Y" or "N" or "n": PROBLEM
>> print "Enter Y or N!"
>> usr = str(raw_in
On Jan 25, 11:26 am, [EMAIL PROTECTED] wrote:
> Hmm, my while loop with "or" doesn't seem to work as I want it to...
> How do I tell the while loop to only accept "Y" or "y" or "N" or "n"
> input from the str(raw_input)?
>
> Thank's in advance!
>
> Snippet of code:
>
> import os
>
> def buildfind
Peter Otten <[EMAIL PROTECTED]> writes:
> > while not usrinp.lower() in "yn":
>
> But note that 'in' performs a substring search and therefore "yn" and ""
> would be accepted as valid answers, too.
Oh right, that's a recent change to the language, I think. OK:
while not usrinp.lower() in list
On 25/01/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote:
> Peter Otten a écrit :
> > Bruno Desthuilliers wrote:
> >
> >> and simplified again thanks to Python 'in' operator:
> >> while not usrinp.lower() in "yn":
> >
> > But note that 'in' performs a substring search and therefore "yn" and ""
>
Peter Otten a écrit :
> Bruno Desthuilliers wrote:
>
>> and simplified again thanks to Python 'in' operator:
>> while not usrinp.lower() in "yn":
>
> But note that 'in' performs a substring search and therefore "yn" and ""
> would be accepted as valid answers, too.
Mmm, right. Thanks for the cor
Bruno Desthuilliers wrote:
> and simplified again thanks to Python 'in' operator:
> while not usrinp.lower() in "yn":
But note that 'in' performs a substring search and therefore "yn" and ""
would be accepted as valid answers, too.
Peter
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
> while usrinp != "y" or "Y" or "N" or "n": PROBLEM
while userinp not in 'yYnN':
...
Or maybe more generally:
while userinp.lower() not in 'yn':# case independent test
...
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] a écrit :
> Hmm, my while loop with "or" doesn't seem to work as I want it to...
> How do I tell the while loop to only accept "Y" or "y" or "N" or "n"
> input from the str(raw_input)?
>
> Thank's in advance!
>
> Snippet of code:
>
> import os
>
> def buildfinder():
> os.s
> while usrinp != "y" or "Y" or "N" or "n": PROBLEM
Correct way:
while usrinp != "y" or usrinp != "Y" or usrinp != "N" or usrinp != "n":
There has to be a boolean evaluation on both sides of or.
Or in this case:
while usrinp not in ['Y', 'y', 'N', 'n']:
Ravi Teja.
--
http://mail.p
Jeffrey Schwab wrote:
> Danny wrote:
>
>> Great! It's been solved.
>>
>> The line, as Glaudio said has a "," at the end and that makes it go
>> onto one line, thanks so much man!
>>
>> var = 0
>> while <= 5:
>> print a[t[var]],
>> var = var +1
>> prints perfectly, thanks so much guys.
>
>
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
probably...
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
It might be important
Danny wrote:
> Great! It's been solved.
>
> The line, as Glaudio said has a "," at the end and that makes it go onto
> one line, thanks so much man!
>
> var = 0
> while <= 5:
> print a[t[var]],
> var = var +1
> prints perfectly, thanks so much guys.
Looping over indexes is kinda unpyth
Danny <[EMAIL PROTECTED]> wrote:
>The programs output will be:
>text
>text
>(etc)
>
>How could I make this print: texttexttexttexttext?
>Ive researched and looked through google and so far I can't find
>anything that will help (or revelent for that matter).
I'm kind of surprised this isn't a FAQ
Danny wrote:
> Great! It's been solved.
>
> The line, as Glaudio said has a "," at the end and that makes it go onto
> one line, thanks so much man!
>
> var = 0
> while <= 5:
>print a[t[var]],
>var = var +1
> prints perfectly, thanks so much guys.
if you wanted spaces between the items, w
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
>
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
>
> I'm just trying to make the
Great! It's been solved.
The line, as Glaudio said has a "," at the end and that makes it go onto
one line, thanks so much man!
var = 0
while <= 5:
print a[t[var]],
var = var +1
prints perfectly, thanks so much guys.
--
http://mail.python.org/mailman/listinfo/python-list
Danny wrote:
> I think I should paste some of the programs code a little more of what I
> want...
>
> var = 0
> while var <= 5:
> print a[t[var]]
> var = var +1
>
> a is a dectionary (very big) and t is a string of text. (if that's
> important right now).
>
> I'm just trying to make th
I think I should paste some of the programs code a little more of what I
want...
var = 0
while var <= 5:
print a[t[var]]
var = var +1
a is a dectionary (very big) and t is a string of text. (if that's
important right now).
I'm just trying to make the value of a[t[var]] print on one l
Danny wrote:
> How could I make this print: texttexttexttexttext?
> Ive researched and looked through google and so far I can't find
> anything that will help (or revelent for that matter).
I am not quite sure, if I simplify the problem but i thought about
something like that:
>>> prin
Danny wrote:
>
As a shortcut:
print "text"*5
--- Heiko.
--
http://mail.python.org/mailman/listinfo/python-list
Danny wrote:
> Hello there.
>
> I'm creating a little text changer in Python. In the program there is a
> while loop. The problem is that a while loop will have 1 print statement
> and it will loop until it gets to the end of the text.
> Example:
>
> num = 5 // Set num to 5
> while num >= 1: /
94 matches
Mail list logo