Hello Daniel, and welcome!
On Sat, Jan 31, 2015 at 08:54:48PM -0500, Daniel M wrote:
Hello. I'm a complete beginner and I’m trying to write a very basic script
to convert temperatures, just for some practice. I have that part down, but
I can’t figure out how to make the script switch between
Hello. I'm a complete beginner and I’m trying to write a very basic script
to convert temperatures, just for some practice. I have that part down, but
I can’t figure out how to make the script switch between the two. What I
would like it to do is let the user go back to the “What do you wish to
On 01/02/15 01:54, Daniel M wrote:
I can’t figure out how to make the script switch between the two. What I
would like it to do is let the user go back to the “What do you wish to
convert?” part when a character is entered instead of a number for
“temperature?”. I tried using
That's quite a
I am currently coding a 'text-based adventure game', and im having a bit of
trouble with while loops. Here is my code so far: #Text-based Adventure RPG
#The player travels through different towns and dungeons
#The overall goal of the game is simple; the player must make it to the final
town,
On 7/7/2012 5:57 AM myles broomes said...
I am currently coding a 'text-based adventure game', and im having a bit
of trouble with while loops. Here is my code so far:
Please paste in the traceback you're getting, and please set your mail
client program for plain text when posting. What I
On 07/07/12 13:57, myles broomes wrote:
I am currently coding a 'text-based adventure game', and im having a bit
of trouble with while loops. Here is my code so far:
What kind of trouble? You have lots of while loops, which loop?
And do you get an error message? If so please post it - all of
# Guess my number
#
# The computer picks a random number between 1 and 100
# The player tries to guess it and the computer lets
# the player know if the guess is to high, to low
# or right on the money
import random
print(\tWelcome to 'Guess My Number'!)
print(I'm thinking of a number between 1
rog capp wrote:
[...]
# Guessing loop
while guess != the_number:
if guess the_number:
print(Lowere...)
else:
print(Higher...)
guess = int(input(Take a guess: ))
tries += 1
print(good job)
input(\n\nPress the enter key to exit.)
This is a program from Python
On 12/14/2011 05:41 PM, rog capp wrote:
# Guess my number
#
# The computer picks a random number between 1 and 100
# The player tries to guess it and the computer lets
# the player know if the guess is to high, to low
# or right on the money
import random
print(\tWelcome to 'Guess My
On 14/12/11 22:41, rog capp wrote:
# Guessing loop
while guess != the_number:
if guess the_number:
else:
guess = int(input(Take a guess: ))
tries += 1
If he/she fails to guess the number after a certain number of attempts
then it displays a message about his failure.It
-Original Message-
From: tutor-bounces+ramit.prasad=jpmorgan@python.org
[mailto:tutor-bounces+ramit.prasad=jpmorgan@python.org] On Behalf Of rog
capp
Sent: Wednesday, December 14, 2011 4:41 PM
To: tutor@python.org
Subject: [Tutor] while loops
# Guess my number
#
# The computer
Alan Gauld wrote:-
Wayne Werner waynejwer...@gmail.com wrote
found = False
highscore = 0
alignment = somealignment
for x in something and not found:
for y in somethingelse and not found:
for z in evenmoresomething:
if x+y+z highscore:
Alan Gauld wrote:
Wayne Werner waynejwer...@gmail.com wrote
You probably want to add a sentinel to break out of the outer
loops too:
I don't think you want to break out of *any* of the loops. Otherwise you
will skip testing combinations. In your example, the first time you set
highscore and
Steven D'Aprano st...@pearwood.info wrote
I don't think you want to break out of *any* of the loops. Otherwise
you will skip testing combinations.
In that case I misread the OP. I thought he specifically wanted
to avoid testing all the options and exit when he reached his target.
In your
Im using the py-postgresql module (docs here:
http://python.projects.postgresql.org/docs/1.0/)
in a python 3.1 environment to connect to my database.
so far everything is working, but I'm having trouble understanding the
structure of the variable returned by a select statement
Generally you
Rance Hall wrote:
Generally you have something like this:
clientlist = get_clients() # where get_clients is a prepared sql statement.
normally you would get the individual rows like this:
for row in clientlist:
do stuff
which is great for a long list of results. But I'm running into
Hi there,
This is the Code. Please check it.It is working fine.
import random
headsCount = 0
tailsCount = 0
count = 1
while count = 100:
coin = random.randrange(2)
if coin == 0:
headsCount += 1
else:
tailsCount += 1
count += 1
print The
Thankyou..!!!
Regards,
Nithya
On Tue, Nov 16, 2010 at 1:51 PM, Luke Pettit petl...@gmail.com wrote:
Arrr thats better Nithya it works fine now. I had it working fine before
it was just coming up with that strange result of 73 and 100
when I copied the code into wing to check it out in order
Greetings,
As a thread starter, I thought I should write the rewritten code I got that
others helped me get to, since this thread is still going on.
# Coin Flips# The program flips a coin 100 times and then# tells you the number
of heads and tailsimport random
print \aprint \tWelcome to 'Coin
Stephanie Dawn Samson sd...@live.ca wrote
thought I should write the rewritten code I got that others helped
me get to
By applying a couple of other ideas that have been suggested you get
something shorter and arguably slightly clearer:
# Coin Flips
# The program flips a coin 100 times and
Just for the heck of it:
heads = sum(random.randrange(2) for i in range(100))
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
Hi Tom,
Your code is almost correct. Little mistake is there.The random number
generate should be in while loop.
import random
# set the coin
headsCount = 0
tailsCount = 0
count = 0
# the loop
while count 100: #If
you declare count =
When I run this code (I'm also a noob) I get this result:-
[evaluate lines 1-22 from untitled-1.py]
The number of heads was 73
The number of tails was 100
Press the enter key to exit.
# Surely, if flipping a single coin 100 times your total number of heads and
tails should add up to 100
# not
Hi Tom,
Your code is almost correct. Little mistake is there.The random number
generate should be in while loop.
import random
# set the coin
headsCount = 0
tailsCount = 0
count = 0
# the loop
while count 100:
#If you declare count = 0. The while loop
When I run this code (I'm also a noob) I get this result:-
[evaluate lines 1-22 from untitled-1.py]
The number of heads was 73
The number of tails was 100
Press the enter key to exit.
# Surely, if flipping a single coin 100 times your total number of heads and
tails should add up to 100
#
On Sun, Nov 14, 2010 at 11:16 PM, Dawn Samson sd...@live.ca wrote:
Greetings,
I'm a Python beginner and working my way through Michael Dawson's Python
Programming for the Absolute Beginner. I'm stuck in a particular challenge
that asks me to write a program that flips a coin 100 times and then
Dawn Samson wrote:
I've been trying to work on this challenge for a while now and can't
get it to work (either it has 100 heads or 100 tails).
Unfortunately your code has been mangled in the email, but I can guess
your problem: you need to set
coin = random.randrange(2)
each time through
Thanks everyone!
I should be using algorithms for even such programs at my level. The solution
to reiterate the coin flip every time in the loop works. Thanks a lot!
Dawn
___
Tutor maillist -
On 14/11/10 22:16, Dawn Samson wrote:
Greetings,
I'm a Python beginner and working my way through Michael Dawson's
Python Programming for the Absolute Beginner. I'm stuck in a
particular challenge that asks me to write a program that flips a
coin 100 times and then tells you the number of
From: tutor-bounces+bermanrl=cfl.rr@python.org
[mailto:tutor-bounces+bermanrl=cfl.rr@python.org] On Behalf Of Dawn Samson
Sent: Sunday, November 14, 2010 5:17 PM
To: tutor@python.org
Subject: [Tutor] While Loops: Coin Flip Game
Greetings,
I'm a Python beginner and working my way through
On Sun, 14 Nov 2010 17:16:36 -0500
Dawn Samson sd...@live.ca wrote:
Greetings,
I'm a Python beginner and working my way through Michael Dawson's
Python Programming for the Absolute Beginner. I'm stuck in a
particular challenge that asks me to write a program that flips a
coin 100 times and
Alex Hall mehg...@gmail.com wrote
I am not sure how else to explain it. I want to loop until the value
of a variable changes, but while that loop is taking place, the user
should be able to perform actions set up in a wx.AcceleratorTable.
And here we have the critical clue. You are trying to
On 7 June 2010 02:37, Alex Hall mehg...@gmail.com wrote:
I am not sure how else to explain it. I want to loop until the value
of a variable changes, but while that loop is taking place, the user
should be able to perform actions set up in a wx.AcceleratorTable.
Looping, though, causes Windows
On 07/06/2010 01:44, Alex Hall wrote:
Further to the other comments that you've had, could you please refer to
the following, thanks.
http://www.catb.org/~esr/faqs/smart-questions.html
Kindest regards.
Mark Lawrence
___
Tutor maillist -
Hi all,
I think that simply erasing those continue statements will let Python
respond again. Those statements are both useless and damaging, because
the following time.sleep(.1) statements will NEVER be executed. And
this, in turn, is IMHO the reason why Python stops responding: it lacks
the
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com; http://www.facebook.com/mehgcap
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 6/6/2010 8:44 PM, Alex Hall wrote:
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com;http://www.facebook.com/mehgcap
What is your question?
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tutor maillist -
On 6/6/10, bob gailer bgai...@gmail.com wrote:
On 6/6/2010 8:44 PM, Alex Hall wrote:
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com;http://www.facebook.com/mehgcap
What is your question?
--
Bob Gailer
919-636-4239
Chapel Hill NC
Why would that code cause
On 06/07/10 11:08, Alex Hall wrote:
On 6/6/10, bob gailer bgai...@gmail.com wrote:
On 6/6/2010 8:44 PM, Alex Hall wrote:
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com;http://www.facebook.com/mehgcap
What is your question?
--
Bob Gailer
919-636-4239
Chapel
On 6/6/10, Lie Ryan lie.1...@gmail.com wrote:
On 06/07/10 11:08, Alex Hall wrote:
On 6/6/10, bob gailer bgai...@gmail.com wrote:
On 6/6/2010 8:44 PM, Alex Hall wrote:
--
Have a great day,
Alex (msg sent from GMail website)
mehg...@gmail.com;http://www.facebook.com/mehgcap
What is your
On 6/6/2010 9:37 PM, Alex Hall wrote:
On 6/6/10, Lie Ryanlie.1...@gmail.com wrote:
On 06/07/10 11:08, Alex Hall wrote:
On 6/6/10, bob gailerbgai...@gmail.com wrote:
On 6/6/2010 8:44 PM, Alex Hall wrote:
--
Have a great day,
Alex (msg sent from GMail website)
Hi all,
First off, I apologize to the list for my previous thread; somehow,
despite my having written the post, it ended up blank ()
I have a main loop which will continue for as long as neither player1
nor player2 has won. Inside that loop I have a call to a function
which should basically
- Forwarded Message
From: Richard Hultgren hultgren1...@yahoo.com
To: tutor@python.org
Sent: Mon, December 7, 2009 2:53:40 PM
Subject: loops
I'm quite new but determined. Can you explain to me, step by step, what is
going on in the computer in this loop. I hope I am not being too
- Forwarded Message
From: Richard Hultgren hultgren1...@yahoo.com
To: tutor@python.org
Sent: Mon, December 7, 2009 2:53:40 PM
Subject: loops
I'm quite new but determined. Can you explain to me, step by step, what is
going on in the computer in this loop. I hope I am not being too
You should probably read some of the links sent to you earlier but here is
a stab at an explanation.
Richard Hultgren wrote on 12/08/2009 10:36:08 AM:
- Forwarded Message
From: Richard Hultgren hultgren1...@yahoo.com
To: tutor@python.org
Sent: Mon, December 7, 2009 2:53:40 PM
Serdar Tumgoren zstumgo...@gmail.com wrote
http://www.freenetpages.co.uk/hp/alan.gauld/
Note the new URL in my sig. Freenet are due to close this site soon.
Its been locked for over a year.
--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/
On Tue, 02 Dec 2008 01:17:41 +, Alan Gauld wrote:
while loops are used much less in Python than in other languages because
for loops are so powerful.
Actually, I think python's for-loop is so powerful that while loop could
be removed from the language and no power would be lost (although
I recently asked a question about 'for' loops, expecting them to be
similar to 'for-next' loops. I have looked at several on-line tutors but
am still in the dark about what 'for' loops do.
Does anyone have a plain English about the use of 'for' loops?
Are 'while' loops the only way Python runs
On Mon, Dec 01, 2008 at 04:44:02PM -0800, WM. wrote:
I recently asked a question about 'for' loops, expecting them to be
similar to 'for-next' loops. I have looked at several on-line tutors but
am still in the dark about what 'for' loops do.
Does anyone have a plain English about the use of
On Mon, Dec 1, 2008 at 6:44 PM, WM. [EMAIL PROTECTED] wrote:
I recently asked a question about 'for' loops, expecting them to be similar
to 'for-next' loops. I have looked at several on-line tutors but am still
in the dark about what 'for' loops do.
Does anyone have a plain English about the
On 02/12/2008, WM. [EMAIL PROTECTED] wrote:
I recently asked a question about 'for' loops, expecting them to be similar
to 'for-next' loops. I have looked at several on-line tutors but am still
in the dark about what 'for' loops do.
Does anyone have a plain English about the use of 'for'
WM. [EMAIL PROTECTED] wrote
I recently asked a question about 'for' loops, expecting them to be
similar to 'for-next' loops. I have looked at several on-line tutors
but am still in the dark about what 'for' loops do.
Python for loops are like foreach loops in other languages.
A Python for
On Mon, Dec 1, 2008 at 7:56 PM, John Fouhy [EMAIL PROTECTED] wrote:
[1] Technically, it iterates over an iterator, which you can think of
as an object that behaves like a list when you throw it at a for loop.
The object of the 'in' must be an iterable, which is an object that
can produce an
I finally got my iterator-based version working, only to discover that
it's nearly four times slower than the brute-force multiple-loops
version I started with! Then I tried just adding an incrementing index
to the loop, so that each loop only ran through
self.events[last_index:], but that
Just for the sake of argument, here's the principle I'm working
from:
#
lst = range(10)
iterlst = iter(lst)
iterlst.next()
0
for x in iterlst:
... if x 5:
... print x
... else:
... break
...
1
2
3
4
for x in iterlst:
... print x
...
On Tue, Aug 26, 2008 at 1:36 AM, Eric Abrahamsen
[EMAIL PROTECTED] wrote:
So my test case: a Month has a 'child' attribute pointing at Week, which has
a 'child' attribute pointing at Day, so they all know what kind of child
instances iteration should produce. With nested loops, a Month
On Aug 26, 2008, at 7:20 PM, Kent Johnson wrote:
On Tue, Aug 26, 2008 at 1:36 AM, Eric Abrahamsen
[EMAIL PROTECTED] wrote:
So my test case: a Month has a 'child' attribute pointing at Week,
which has
a 'child' attribute pointing at Day, so they all know what kind of
child
instances
Eric Abrahamsen [EMAIL PROTECTED] wrote
So that's why I'm creating the iterator outside of the while loop in
the original code, and then using a repeated for loop with a break
to step through all the events only once. Of course, the fact that
5 isn't in there probably points to the source
On Tue, Aug 26, 2008 at 1:24 PM, Eric Abrahamsen
[EMAIL PROTECTED] wrote:
On Aug 26, 2008, at 7:20 PM, Kent Johnson wrote:
If all you want to do with the nested Month, etc is to iterate the
events in them, you could probably use a shared iterator. It would
have to be able to push-back items
Okay I think I'm onto something, more iterator-related stuff. If I can
make self.events an iterator, then run a for loop on it, breaking out
of the loop when the events' date attributes get too high. Then on the
next run through, that same for loop should pick up where it left off,
right?
I'm not following your code very well. I don't understand the
relationship between the first loop and the iter_children() function.
A couple of things that might help:
- Django QuerySets can be qualified with additional tests, so you
could have each of your month/week/etc classes have its own
I do apologize for the large quantities of confusing description –
articulating the problem here has helped me understand exactly what it
is I'm after (though it hasn't improved my code!), and I've got a
better grasp of the problem now than I did when I first asked.
It isn't so much that I
On Aug 24, 2008, at 7:20 PM, Kent Johnson wrote:
Forwarding to the list with my reply. Please use Reply All to reply
to the list.
Grr, sorry, I keep forgetting...
On Sun, Aug 24, 2008 at 1:02 AM, Eric Abrahamsen
[EMAIL PROTECTED] wrote:
On Aug 23, 2008, at 11:22 PM, Kent Johnson
Hi,
I've got a problem that takes a bit of explaining, but it's relatively
simple when you get down to it. This is another django-related thing,
but the issue itself is pure python.
I made a custom class, called an EventEngine, which represents a span
of time. You initialize it with a
On Sat, Aug 23, 2008 at 6:47 AM, Eric Abrahamsen
[EMAIL PROTECTED] wrote:
At first I thought the bisect module was the way to go, but it is too
tightly tied to integer list indices, and works very awkwardly when
bisecting on datetime attributes.
I'm not sure what the problem is with bisect (to
Umesh Singhal wrote:
Hi im still relatively new to python and i am designing a
multiplication table that enables a user to input the size of the
times table unfortunately ive stumbled on the nested loops this is
what i have right now:
a=raw_input('please enter a number')
b=int(a)
n=b+1
for
On Sat, Aug 16, 2008 at 06:33:42AM +0100, Umesh Singhal wrote:
Hi im still relatively new to python and i am designing a multiplication
table that enables a user to input the size of the times table unfortunately
ive stumbled on the nested loops this is what i have right now:
Is this a
On Sat, 2008-08-16 at 18:07 +0200, [EMAIL PROTECTED] wrote:
Message: 1
Date: Sat, 16 Aug 2008 06:33:42 +0100
From: Umesh Singhal [EMAIL PROTECTED]
Subject: [Tutor] For Loops and nested loops
To: tutor@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=windows-1252
PLEASE REPLY TO THE GROUP NOT JUST ME. Did you miss my request for that
(reply-all)?
Umesh Singhal wrote:
Hi Bob,
unfortunately when i pasted in the code it seems to have gone wrong
this is how it is at the moment with the correct indentation for the
nested loop:
code:
Greetings,
On Dec 6, 2007 12:44 AM, earlylight publishing
[EMAIL PROTECTED] wrote:
Hello again to all the wonderfully helpful folks on this list. Today I did
my Google homework and I found this neat bit of code for a countdown timer.
import time
import threading
class
Hello again to all the wonderfully helpful folks on this list. Today I did my
Google homework and I found this neat bit of code for a countdown timer.
import time
import threading
class Timer(threading.Thread):
def __init__(self, seconds):
self.runTime = seconds
Hi all,
Just a quick question, really. Is there any good way to have an infinite
loop in a program, without said infinite loop eating up the CPU? I've
tried the trick of adding a pause (time.sleep(0.01)) somewhere in the
loop, and this appears to have worked on a basic infinite loop, but this
Jonathan McManus wrote:
Hi all,
Just a quick question, really. Is there any good way to have an infinite
loop in a program, without said infinite loop eating up the CPU? I've
tried the trick of adding a pause (time.sleep(0.01)) somewhere in the
loop, and this appears to have worked on a
Kent Johnson wrote:
Jonathan McManus wrote:
Hi all,
Just a quick question, really. Is there any good way to have an infinite
loop in a program, without said infinite loop eating up the CPU? I've
tried the trick of adding a pause (time.sleep(0.01)) somewhere in the
loop, and this appears
On 24/12/06, Luke Paireepinart [EMAIL PROTECTED] wrote:
Kent Johnson wrote:
Jonathan McManus wrote:
Hi all,
Just a quick question, really. Is there any good way to have an
infinite
loop in a program, without said infinite loop eating up the CPU? I've
tried the trick of adding a pause
Luke Paireepinart [EMAIL PROTECTED] On Sun, 24 Dec 2006 10:02:19
-0600 wrote: Kent Johnson wrote:
Kent et. al.,
I'm writing something that has to do with sockets.
I need to recv any incoming packets from the socket.
I will have potentially hundreds of separate sockets open in a single
Luke Paireepinart wrote:
Kent et. al.,
I'm writing something that has to do with sockets.
I need to recv any incoming packets from the socket.
I will have potentially hundreds of separate sockets open in a single
application.
I was just going to create a thread for each, so I could
Does python have foreach loops? I don't see any
mention of them in the docs. Am I going to have to
use Perl (gasp!) if I want my beloved foreach loop?
Its called a for loop in Python...
Or is there some extra magic in the Perl version that I'm missing?
Alan G.
I was thinking more along the lines of this:
A C++ for loop:
This is exactly NOT a foreach loop, its a vanilla for loop.
#include iostream
using std::cout;
int main() {
for (int i = 0; i 10; i++) {
cout i \n;
}
for i in range(10): print i
Alan G.
Does python have foreach loops? I don't see any
mention of them in the docs. Am I going to have to
use Perl (gasp!) if I want my beloved foreach loop?
-Chris
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Does python have foreach loops? I don't see any mention of them in the
docs. Am I going to have to use Perl (gasp!) if I want my beloved
foreach loop?
Can you show an example of a Perl foreach loop? Perhaps someone can help
translate it into idiomatic Python.
Good luck!
Danny Yoo wrote:
Does python have foreach loops? I don't see any mention of them in the
docs. Am I going to have to use Perl (gasp!) if I want my beloved
foreach loop?
Can you show an example of a Perl foreach loop? Perhaps someone can help
translate it into idiomatic Python.
Christopher Spears wrote:
Hmmm...Perl is probably a bad example. My apologies.
I was thinking more along the lines of this:
A C++ for loop:
#include iostream
using std::cout;
int main() {
for (int i = 0; i 10; i++) {
cout i \n;
}
Christopher Spears wrote:
Hmmm...Perl is probably a bad example. My apologies.
I was thinking more along the lines of this:
A C++ for loop:
#include iostream
using std::cout;
int main() {
for (int i = 0; i 10; i++) {
cout i \n;
}
def increment(time, seconds):
time.seconds = time.seconds + seconds
while time.seconds = 60:
time.seconds = time.seconds - 60
time.minutes = time.minutes + 1
Tale a look at what this loop is doing.
Think about its purpose. If you werre doing this
with paper and pencil would you
I am working on another problem from How To Think
Like A Computer Scientist. Here is a function:
def increment(time, seconds):
time.seconds = time.seconds + seconds
while time.seconds = 60:
time.seconds = time.seconds - 60
time.minutes = time.minutes + 1
while time.minutes = 60:
Christopher Spears schrieb:
IF you know that it's 2 seconds after midnight,
how many hours, minutes, seconds after midnight ist this.
If you should compute this by hand, how would you proceed?
Best wishes,
Gregor
I am working on another problem from How To Think
Like A Computer
On 12/07/06, Christopher Spears [EMAIL PROTECTED] wrote:
Now the exercise is:
As an exercise, rewrite this function so that it
doesn't contain any loops.
I have been staring at this function and drawing a
blank. Something tells me that I need to use
iteration, but I am not sure how I could
--- John Fouhy [EMAIL PROTECTED] wrote:
On 12/07/06, Christopher Spears
[EMAIL PROTECTED] wrote:
Now the exercise is:
As an exercise, rewrite this function so that it
doesn't contain any loops.
I have been staring at this function and drawing a
blank. Something tells me that I
Christopher Spears wrote:
I am working on another problem from How To Think
Like A Computer Scientist. Here is a function:
def increment(time, seconds):
time.seconds = time.seconds + seconds
while time.seconds = 60:
time.seconds = time.seconds - 60
time.minutes = time.minutes
I feel like there should be a better way to do this process:
Can you please help?
(This is trivial example code I created off the top of my head, but the
same concept that I am trying to do elsewhere.)
class Person(object):
def __init__(self, first_name, age, fav_color):
Emily Fortuna wrote:
I feel like there should be a better way to do this process:
Can you please help?
(This is trivial example code I created off the top of my head, but the
same concept that I am trying to do elsewhere.)
class Person(object):
def __init__(self, first_name, age,
+++ Emily Fortuna [22-06-06 13:22 -0400]:
| I feel like there should be a better way to do this process:
| Can you please help?
| (This is trivial example code I created off the top of my head, but the
| same concept that I am trying to do elsewhere.)
|
| class Person(object):
| def
* josip [EMAIL PROTECTED] [2006-04-11 09:13]:
I have problem with this question.
Can someone show me the code and than explain it?
Write a Python program to print out the following shape. You are
expected to use two for loops (these must be nested) to solve this problem.
Write a Python program to print out the following shape.
You are expected to use two for loops (these must be nested) to solve
this problem.
output:
* * * * *
* *
* *
* * * * *
That looks a lot like homework.
I agree and very poor homework too.
I
Matthew White wrote:
Hello,
From a general style and/or programmatic perspective, which is a better
way to write this bit of code?
Hmm, neither?
try:
(dn, attrs) = conn.search_s(search_base, search_scope, search_filter,
search_attrs):
except Exception, e:
warn_the_user(e)
Hello,
From a general style and/or programmatic perspective, which is a better
way to write this bit of code?
try:
(dn, attrs) = conn.search_s(search_base, search_scope, search_filter,
search_attrs):
except Exception, e:
warn_the_user(e)
do_something_useful()
for (name,
Is there any way more efficient for run a nested loop?
--
for a in list_a:
for b in list_b:
if a == b: break
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Mon, 22 Aug 2005, Kent Johnson wrote:
Is there any way more efficient for run a nested loop?
--
for a in list_a:
for b in list_b:
if a == b: break
Hi Jonas,
Depends on what we're trying to do. Is it necessary to have a nested loop
here? What kind of problem is
Thanks for the help guys.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
100 matches
Mail list logo