Re: [Tutor] syracuse sequence (collatz or hailstone)

2005-10-30 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > would this be a possible use of a list and appending even though I recieve > an error from it: > > def main(): > x = [1] > x[0] = input('enter an int to start your syracuse sequence\n') > while not isinstance(x[0], int): > x[0] = input('no, please

Re: [Tutor] AJAX resources for Python

2005-10-30 Thread Andrew P
Turbogears seconded. It's a really great collection of tools. As an alternative, you may also want to check out Nevow. From the webpage: "Nevow includes LivePage, a two-way bridge between JavaScript in a browser and Python on the server. For 0.3, LivePage has been updated to operate on Mozilla

[Tutor] Transforming object into subclass instance

2005-10-30 Thread Jan Eden
Hi, my program uses an initial "switch" statement to create an object: valid_types = dict( pages=Show.Page, syndicated=Show.Syndicated, authors=Show.Author, author_list=Show.AuthorList, galleries=Show.Gallery, pictures=Show.Picture, slideshow=Show.SlidePicture, tex

Re: [Tutor] Python as Application (OT now)

2005-10-30 Thread Alan Gauld
> Papers are generally poorly formatted. Things like using the space > bar or tab key to center things. Then even when the docs do open > up, the formatting is all askew. > This is one of my pet peeves. Many so called MS Office training courses barely touch on the use of paragraph formats, very f

[Tutor] help with prime number program

2005-10-30 Thread andrade1
Hello I am trying to write a program that will figure out if a number is prime or not. Currently this is the code that I have: import math def main(): number=input("Please enter a positive whole number greater than 2: ") for value in range(2, number-math.sqrt): if number % value

Re: [Tutor] help with prime number program

2005-10-30 Thread Danny Yoo
> I am trying to write a program that will figure out if a number is prime > or not. Currently this is the code that I have: [code cut] Hi Andrade1, As in your other previous homework programs, you seem to have some trouble with control flow. Have you considered talking with your professor or

Re: [Tutor] Transforming object into subclass instance

2005-10-30 Thread Kent Johnson
Jan Eden wrote: > Now my question is: How can I turn an object of class X into an > object of either class Y or Z while (retaining all the attributes > defined so far). This is easy, in fact - you can change the class of an instance by assigning to its __class__ attribute: >>> class F(object):

Re: [Tutor] help with prime number program

2005-10-30 Thread andrade1
> > >> I am trying to write a program that will figure out if a number is prime >> or not. Currently this is the code that I have: > > [code cut] > > Hi Andrade1, > > As in your other previous homework programs, you seem to have some trouble > with control flow. Have you considered talking with yo

Re: [Tutor] help with prime number program

2005-10-30 Thread Adam
    > 1.  What is 'exit'? instead of exit I can use break so that the loop will stop executing> 2.  What is 'number - math.sqrt'?for math.sqrt I could use math.sqrt(n) so that it would take the sqrt of nwhich is entered in by the userHowever for the output I am still receivingenter a numbe

[Tutor] Newbie Question - Python vs Perl

2005-10-30 Thread Scott Clausen
As a newbie to Python I'd like to know if someone can tell me some strengths and weaknesses of this language. The reason I'm asking is a friend told me I should learn Perl over Python as it's more prevalent. I'm going to be using it on a Mac. I'd appreciate hearing any views on this topic.

Re: [Tutor] Newbie Question - Python vs Perl

2005-10-30 Thread Kent Johnson
Scott Clausen wrote: > As a newbie to Python I'd like to know if someone can tell me some > strengths and weaknesses of this language. The reason I'm asking is a > friend told me I should learn Perl over Python as it's more > prevalent. I'm going to be using it on a Mac. http://wiki.pytho

Re: [Tutor] python myspace module?

2005-10-30 Thread Andrew P
Probably the most useful library from the wwwsearch page Danny pointed you to is the cookielib, which is built into Python as of 2.3 or 2.4. The most useful because you can't scrape by without it on most sites, and cookies are really no fun to handle manually Login and forms can largely be fudged