At 09:49 PM 10/1/2006, Luke Paireepinart wrote:
I had no idea you could have an
'else' tied to a 'while' loop.
Interesting
I looked this up in Python in a Nutshell. From p. 69:
The else Clause on Loop Statements
while and for statements may optionally have a
trailing else clause. The statemen
On 02/10/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
> I had no idea you could have an 'else' tied to a 'while' loop.
> Interesting
It allows you to distinguish between exiting the loop via a break and
exiting the loop normally.
eg:
>>> for i in range(10):
... break
... else:
... prin
Alan Gilfoy wrote:
> -code block-
>
> number = 3
> running = True
>
> while running:
>guess = int(raw_input("Please enter a number : ")) #lets user guess a
> number
>
>if guess == number:
>print "Yay, you got the right number, good for you. But you
> don't get any prizes. Do I loo
C:\>python -m timeit -s"x=0" "while x<100:" " x+=1"
1000 loops, best of 3: 0.123 usec per loop
C:\>python -m timeit -s"for x in range(100):" "x+=1"
Traceback (most recent call last):
File "E:\Python25\lib\runpy.py", line 95, in run_module
filename, loader, alter_sys)
File "E:\
> One of my community advisers suggested I start with Python. (he also
> suggested this mailing list)
take a look at "how to think like a computer scientist" by downey,
elkner, etc. it was originally written for C++ and Java but Jeff
Elkner, a high school programming AP instructor, ported it to
Paulino wrote:
Hi Paulino,
Tough question that. What is your existing web server? That'd be a good
starting point. Zope/Plone are great, but they have a steep learning
curve that doesn't seem essential to what you're doing. Django is
simpler, but once again, doesn't immediately fit to what you
On 10/1/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> On 02/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> > or maybe random sample:
> > In [22]: random.sample(('heads', 'tails'), 1)[0]
> > Out[22]: 'tails'
>
> I think random.choice would be a better option here:
>
> >>> random.choice(['heads', 'ta
--- Kefka Palazzo <[EMAIL PROTECTED]> wrote:
> I am trying to learn a programming language good for
> programming entire
> games (core functions too) similar to both the Final
> Fantasy and Metroid
> series. From the book I'm learning from (Python
> Programming for the Absolute
> Beginner, by Mich
I am a senior at the School Without Walls in Rochester, NY. As such, I
get to do a senior project. I decided to work on computer programming,
since that is sometihng that I certianly think can hold my interest
throughout the school year.
(despite my compute rinteresat, I've never done anything
-code block-
number = 3
running = True
while running:
guess = int(raw_input("Please enter a number : ")) #lets user guess a number
if guess == number:
print "Yay, you got the right number, good for you. But you
don't get any prizes. Do I look like a walking ATM to you?"
runn
On 02/10/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> or maybe random sample:
> In [22]: random.sample(('heads', 'tails'), 1)[0]
> Out[22]: 'tails'
I think random.choice would be a better option here:
>>> random.choice(['heads', 'tails'])
'tails'
>>> [random.choice(['heads', 'tails']) for i in r
Sorry, a slip of the mouse let that through.
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi!
Im a very biginner in programming and I started with python, witch I
found much easier tahn i thought.
I want to build an intranet page in my organization that shows some data
from our financial aplication's database.
For the starting point I would like it to show invoices lists per
suppl
Changing Mobile and Landline Number no more a problem !
Whenever we change our telephone numbers (both Mobile and Landline) and Service Providers (all providers such as BSNL, Reliance, Tata Indicom, Airtel/Hutch, Aircel, etc.), we miss out a number of valuable contacts and as a result we even i
Dick Moores wrote:
> Works fine, but instead of
> coin1 = random.randint(1, 10)
> coin2 = random.randint(1, 10)
>
> you could simplify by using
> coin1 = random.randrange(2)
> coin2 = random.randrange(2)
or maybe random sample:
In [22]: random.sample(('heads', 'tails'), 1)[0]
Out[22]: 'tails'
Ke
At 04:38 PM 10/1/2006, Will Shattuck wrote:
>Hi all,
>
>I thought that it would be a great idea to learn Python while porting
>the BASIC code from this book. So I printed all the pages, have them
>"bound" by a big binder clip, and read through the first bit.
>
>In Chapter 2 there is a type of "Cho
On 10/1/06, John Fouhy <[EMAIL PROTECTED]> wrote:
> On 02/10/06, Will Shattuck <[EMAIL PROTECTED]> wrote:
> > I'm going through the tutorial "Learning to Program" at
> > http://www.freenetpages.co.uk/hp/alan.gauld/. I reached the section
> > talking about sys.exit(). I typed it in as indicated, b
On 02/10/06, Will Shattuck <[EMAIL PROTECTED]> wrote:
> I'm going through the tutorial "Learning to Program" at
> http://www.freenetpages.co.uk/hp/alan.gauld/. I reached the section
> talking about sys.exit(). I typed it in as indicated, but I received
> errors rather than it actually exiting the
I'm going through the tutorial "Learning to Program" at
http://www.freenetpages.co.uk/hp/alan.gauld/. I reached the section
talking about sys.exit(). I typed it in as indicated, but I received
errors rather than it actually exiting the Python Shell windows
generated when starting IDLE. Here is t
Hi all,
I thought that it would be a great idea to learn Python while porting
the BASIC code from this book. So I printed all the pages, have them
"bound" by a big binder clip, and read through the first bit.
In Chapter 2 there is a type of "Choose Your Own Adventure" type
section. Since I didn
wesley chun wrote:
>> I am trying to learn a programming language good for programming entire
>> games (core functions too)
>
> check out the PyGame engine:
> http://pygame.org
>
> download the games written on top of PyGame that appear to match the
> functionality you're looking for. if you lea
> I am trying to learn a programming language good for programming entire
> games (core functions too)
check out the PyGame engine:
http://pygame.org
download the games written on top of PyGame that appear to match the
functionality you're looking for. if you learn Python at the same
time, tweak
Kefka Palazzo wrote:
> OK, first of all, I just started learning python a few hours ago so
> deal with me here.
>
> I'm picking up quite fast on Python since I took a C++ class a year
> ago when i was 13. However, before I go deep into learning it, I want
> to know if Python will work for the p
OK, first of all, I just started learning python a few hours ago so deal with me here.
I'm picking up quite fast on Python since I took a C++ class a year ago
when i was 13. However, before I go deep into learning it, I want to
know if Python will work for the purpouses I need.
I am trying
Andrew Robert wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Hi guys,
>
> Awhile back, I believe I saw a cookbook recipe for splitting and
> reassembling text/binary files.
>
> Does anyone know where this or something similar can be found?
Searching the cookbook for 'split file' f
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Never mind.. :)
found it at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/224800
However, if someone has something better, I would be very interested.
Andrew Robert wrote:
> Hi guys,
>
> Awhile back, I believe I saw a cookbook recipe f
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi guys,
Awhile back, I believe I saw a cookbook recipe for splitting and
reassembling text/binary files.
Does anyone know where this or something similar can be found?
I am working on a file transfer mechanism via MQSeries and breaking
large files
mike viceano wrote:
> hello i wrote a litle program ware you pick a number and the computer
> guesses it and i recently decided to make it so it dosint reguess
> numbers but now i get a error message
>
> here is the program
>
> def number(number):
>from random import randrange
>guess=rand
Liam Clarke wrote:
> Hi all,
>
> I'm writing a wiki at the moment, and I want to store unified diffs to
> allow easy reverting between versions of a document. It appears that
> difflib.restore() can only generate original text from diffs returned
> from ndiff() or compare() which store the full
hello i wrote a litle program ware you pick a number and the computer
guesses it and i recently decided to make it so it dosint reguess
numbers but now i get a error message
here is the program
def number(number):
from random import randrange
guess=randrange(number*2)
print guess
gues
Dick Moores wrote:
> At 01:37 PM 9/30/2006, Shantanoo Mahajan wrote:
>
>> Maybe following is helpful:
>>
>>
> a=[3,2,1]
> b=a[:]
> b.sort()
> c=sorted(a)
> print a,b,c
> [3, 2, 1] [1, 2, 3] [1, 2, 3]
>
>
>> Shantanoo
>>
>
> Sorry to be dense,
At 01:37 PM 9/30/2006, Shantanoo Mahajan wrote:
>Maybe following is helpful:
>
> >>> a=[3,2,1]
> >>> b=a[:]
> >>> b.sort()
> >>> c=sorted(a)
> >>> print a,b,c
> >>> [3, 2, 1] [1, 2, 3] [1, 2, 3]
> >>>
>
>Shantanoo
Sorry to be dense, but I don't see what showing what happens to a
copy of list a ad
Hi all,
I'm writing a wiki at the moment, and I want to store unified diffs to
allow easy reverting between versions of a document. It appears that
difflib.restore() can only generate original text from diffs returned
from ndiff() or compare() which store the full text of both versions.
As thi
33 matches
Mail list logo