Re: [Tutor] if statement

2010-11-02 Thread christopher . henk
Glen Clark wrote on 11/02/2010 03:07:18 PM: in general you should use raw_input instead of input. > confirmed = int(input("Are you happy with this? (y/n): ") > you are missing a closing parenthesis above, and converting a string (y,n) to and int > if confirmed == "y": you are comparing an in

Re: [Tutor] LCM

2010-10-20 Thread christopher . henk
benderjaco...@gmail.com wrote on 10/20/2010 07:30:32 PM: > > thing = raw_input("What is the first number?\n\n") > > thing2 = raw_input("What is the second number?\n\n") > > int(thing) > int(thing2) > The two lines above do the calculation of turning your input strings into int's but d

Re: [Tutor] input problem

2010-09-13 Thread christopher . henk
ANKUR AGGARWAL wrote on 09/13/2010 04:45:41 PM: > Suppose i am taking input or various variables like > a=raw_input("...") //hello > b=raw_input("")//hi > c=raw_input("...")//hello > d=raw_input("..")//hello > but i want to run a common function when

Re: [Tutor] import problem

2010-08-28 Thread christopher . henk
tutor-bounces+christopher.henk=allisontransmission@python.org wrote on 08/28/2010 12:54:28 PM: > Hello, > > Im trying to do a import on a linux machine. > But now Im gettting this message : > > Python 2.6.5 (r265:79063, Apr 1 2010, 05:28:39) > [GCC 4.4.3 20100316 (prerelease)] on linux2

Re: [Tutor] exercise problem

2010-08-27 Thread christopher . henk
Roelof Wobben wrote on 08/27/2010 12:18:01 PM: > > > > Date: Fri, 27 Aug 2010 12:00:23 -0400 > > From: bgai...@gmail.com > > To: rwob...@hotmail.com > > CC: tutor@python.org > > Subject: Re: [Tutor] exercise problem > > > > I have been reading your posts and responses. I find myself frustrated

Re: [Tutor] Databases in Python

2010-08-24 Thread christopher . henk
aug dawg wrote on 08/24/2010 01:55:14 PM: > Now it says that the variable adder is not defined. Does anyone know about this? > It is best if you send the full error message, it helps pinpoint the problem. my copy of your code was: database = [] datafile = open('/home/~/the-db/data') for line i

Re: [Tutor] Databases in Python

2010-08-24 Thread christopher . henk
aug dawg wrote on 08/24/2010 01:13:01 PM: > It's not catching that, but I haven't gotten there with the bugs yet. One more thing I can't figure out. > > line 11 > select-db = raw_input("Which database to add to? >> ") > SyntaxError: can't assign to operator > > I think it might be the >> at

Re: [Tutor] Searching a text file's contents and comparing them toalist

2010-07-14 Thread christopher . henk
Eric Hamiter wrote on 07/14/2010 04:57:57 PM: > Thanks for the pointers! This is now working, albeit probably ugly and clunky: > > > aisle_one = ["chips", "bread", "pretzels", "magazines"] > aisle_two = ["juice", "ice cream"] > aisle_three = ["asparagus"] > > def find_groceries(): > with o

Re: [Tutor] Fw: loops

2009-12-08 Thread christopher . henk
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 > To: tutor@python.org > Sent: Mon, December 7, 2009 2:53:40 PM > Subject: loops > I'm

Re: [Tutor] Equivalent exception of os.path.exists()

2009-11-30 Thread christopher . henk
biboy mendz wrote on 11/30/2009 03:04:52 PM: > > > spir wrote: > > > > What is your question? > > If it's about the type of exception raised when os.path.exists fails, well, sure it's hard to find: > > > > print os.path.exists("foo".bar) > > ==> False > > > > > My question is: i'm looking

Re: [Tutor] Fwd: Help on finding the 1000th prime

2009-11-16 Thread christopher . henk
Kent Johnson wrote on 11/16/2009 04:00:02 PM: > -- Forwarded message -- > From: Ray Holt > Date: Mon, Nov 16, 2009 at 1:55 PM > Subject: RE: [Tutor] Help on finding the 1000th prime > To: Kent Johnson > > > I hit the send button before I was ready. Here is the code that doesn'

Re: [Tutor] Help on finding the 1000th prime

2009-11-16 Thread christopher . henk
mrhol...@sbcglobal.net wrote on 11/16/2009 10:56:07 AM: > I have posted this on other lists, but have just discovered this one. Welcome to the list. I am sure you will find plenty of folks here who will be happy to help you. > Can someone give me help on writing the code > necessary

Re: [Tutor] Recursive user input collection problem

2009-10-13 Thread christopher . henk
> I need to collect a couple of integers from a user, but I want to make > sure that I actually get integers. I tried this, but subsequent calls > to the function don't update variable. I'm not sure this is terribly > clear - here's the code: > > num_of_articles = 0 > num_of_reviewers = 0 > > d

Re: [Tutor] need help with conditionals

2009-09-25 Thread christopher . henk
> Hello all, > I am still very new to Python and am working on conditionals. Im stuck on this > problem and I'm sorry if this is something really simple that I'm missing but its > been really frustrating me. Here's a copy of the problem, and sorry if its really > long but its the end questio

Re: [Tutor] invalid syntax (reply)

2009-09-24 Thread christopher . henk
tutor-bounces+christopher.henk=allisontransmission@python.org wrote on 09/24/2009 05:43:24 PM: > Robert, that is my code. The error? "Theres an error in your program : > invalid syntax" > Closing the parenthesis helped that one, but my else statement is not > working...heres the code chunk.

Re: [Tutor] Unknown reason for error.

2009-09-24 Thread christopher . henk
> Hello, python tutors, its Corey. Hi, Corey. > candyNumber = raw_input("How many candies do you want? :" You dropped a closing parenthesis in the line above. Having the syntax error occur one line up from where it is indicated is not uncommon. Another thing as long as we are here, in

Re: [Tutor] Poorly understood error involving class inheritance

2009-09-10 Thread christopher . henk
tutor-bounces+christopher.henk=allisontransmission@python.org wrote on 09/10/2009 04:13:23 PM: > I'm not sure why I'm getting an error at the end here: > > >>> class dummy: > ... def __init__(self,dur=0): > ... self.dur=dur > ... > >>> z=dummy(3) > >>> z.dur > 3 > >>> z=d

Re: [Tutor] Help needed

2009-06-16 Thread christopher . henk
> My Original message: > > I had previously emailed y'all regarding inverting a message input by the user of the program backwards. After much > contemplation on your earlier replies I came up with the code I have included in this email. The problem I am having > with this code is that the the

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread christopher . henk
Just glancing at your program, I would guess that you have a ":" where you want a "]" on the line below. prod = prod * letter_to_prime[word_list[j] [i]: HTH, Chris jessica cruz Sent by: tutor-bounces+christopher.henk=allisontransmission@python.org 03/09/2009 02:38 PM To Tutor@p

Re: [Tutor] reciprocal import

2008-12-16 Thread christopher . henk
Although you generally would want to design so that this does not happen, if the import of the first module is only needed in some of the functions in the second module, you can include the import within the function definition and that would work ok. But you can't have the second import at the

Re: [Tutor] decision structures

2008-10-21 Thread christopher . henk
> Perhaps someone else will help you. I won't offer anything more until you respond to a lot more of my questions and comments. > Read what Bob has written back to you and try it or ask questions related to it if you don't understand something he said. > AND PLEASE reply to tutor@python.org as

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread christopher . henk
I am not sure how you got from the input to your variable i, it is a good idea to post your code as well. That said raw_input will return the user's input as a string which you then need to convert to integers. So the commas are brought in as well. You can solve this in a couple of ways: First,

Re: [Tutor] dealing with user input whose value I don't know

2008-10-02 Thread christopher . henk
[EMAIL PROTECTED] wrote on 10/02/2008 01:06:29 PM: > Hello, > > I am trying to do some exercises in John Zelle's book (chapter 4). > I got stuck: > > "Write a program that finds the average of a series of numbers entered > by the user. The program should first ask the user how many numbers >

Re: [Tutor] not operator

2008-09-18 Thread christopher . henk
[EMAIL PROTECTED] wrote on 09/18/2008 06:12:30 PM: > i want to check if a dir does not exist. how do i change this statement > to evaluate is NOT existing? ==False or ! operator. Also, is sys.exit > appropriate to use to quit out of the program? > > if(os.access(target_dir, os.F_OK)): >print

Re: [Tutor] Hay Variables

2008-09-12 Thread christopher . henk
I would use a list of grades and the length of the list. Chris "Jeremiah Stack" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 09/12/2008 02:08 PM To "Python Tutor" cc Subject [Tutor] Hay Variables Sorry, Okay, Say i want to calculate the average for Math = 91 Science = 97 and Engl

Re: [Tutor] Help with checking for a data type

2008-09-04 Thread christopher . henk
try and convert the first value in the split list to a int (or float), if that works then post the value. if it throws an exception (ValueError) then catch that and pass, or do whatever else needs doing with the listing. def postData(inputData): fields=inputData.split("-") try: n

Re: [Tutor] Message 'list' object has no attribute 'strptime ?

2008-09-04 Thread christopher . henk
It looks to me that your variable: time = in_time.split(":") is hiding the time module. Chris Wayne Watson <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 09/04/2008 04:05 PM To "tutor@python.org" cc Subject Re: [Tutor] Message 'list' object has no attribute 'strptime ? Further info

Re: [Tutor] 180MB

2008-05-27 Thread christopher . henk
Looking at my system, it looks like you 180MB is for all your python packages together, not each one. I get 68.67MB under my add/remove which is the size of my Python folder. Chris "Switanek, Nick" <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 05/27/2008 04:54 PM To cc Subject [Tutor] 18

Re: [Tutor] Random module error

2008-05-15 Thread christopher . henk
Your original post showed this traceback: Traceback (most recent call last): File "", line 1, in File "C:\Python25\swampy.1.1\TurtleWorld.py", line 1, in from World import * File "C:\Python25\swampy.1.1\World.py", line 29, in import random File "C:\Python25\random.py", line 4, in

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread christopher . henk
this works for me. Z=", ".join(["%s:%s" %(a,Y[b]) for b,a in enumerate(X)]) lechtlr <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 12/21/2007 11:00 AM To tutor@python.org cc Subject [Tutor] Using 'join ' function to create a string Hi there, I would like to know what is the best wa

Re: [Tutor] New Introductory Book

2007-11-08 Thread christopher . henk
[EMAIL PROTECTED] wrote on 11/08/2007 05:19:59 PM: > "Chris Calloway" <[EMAIL PROTECTED]> wrote > > > teach languages. Teaching languages is frowned upon in some computer > > science departments under the logic that if you belong in a computer > > science class, you'd better show up for class alr

Re: [Tutor] Decimal Conversion

2007-10-15 Thread christopher . henk
However since r is an int and b is a string, you will get an error when you try and concatenate them. >>> b='' >>> b+=1 Traceback (most recent call last): File "", line 1, in TypeError: cannot concatenate 'str' and 'int' objects So you need to convert r to a string before you assign it to b >>

Re: [Tutor] Updating MySQL Database

2007-10-10 Thread christopher . henk
That Slashdot comment makes so much more sense now. Chris Henk Allison Transmission phone: 317.242.2569 cell: 765.337.8769 fax: 317.242.3469 e-mail: [EMAIL PROTECTED] Kent Johnson <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 10/10/2007 08:52 AM To Python Tutorlist cc Subject Re: [Tutor

Re: [Tutor] Finding prime numbers

2007-09-19 Thread christopher . henk
[EMAIL PROTECTED] wrote on 09/19/2007 12:38:49 PM: > Sorry about that. > > I have posted the code below: > > #!/usr/bin/env python > > '''A program to generate prime numbers when given 2 numbers''' > > def isPrime(number): > number=abs(int(number)) > #1 is not considered a prime number

Re: [Tutor] Livewires

2007-09-10 Thread christopher . henk
[EMAIL PROTECTED] wrote on 09/10/2007 07:29:24 AM: > Hi all > > just learning python really and been using the livewires tutorial / worksheets to get some experience. > > I have hit an issue which is just my lack of understanding around looping concepts and execution. > > My issue: > > in wo

[Tutor] Fw: Starting classes

2007-08-31 Thread christopher . henk
Oops, forgot to reply all. Chris Henk - Forwarded by Christopher Henk/US/ATD/GMC on 08/31/2007 04:55 PM - Christopher Henk/US/ATD/GMC 08/31/2007 04:13 PM To "Ara Kooser" <[EMAIL PROTECTED]> cc Subject Re: [Tutor] Starting classes The class definition will only

Re: [Tutor] Livewires - stuck on a class

2007-08-14 Thread christopher . henk
[EMAIL PROTECTED] wrote: ->To: tutor@python.org>From: Tonu Mikk <[EMAIL PROTECTED]>>Sent by: [EMAIL PROTECTED]>Date: 08/14/2007 03:23PM>Subject: [Tutor] Livewires - stuck on a class>>I made some progress on the Livewires robots game - I got as far as>page >10 on the attached 5-robots.pdf file.

Re: [Tutor] odd bug

2007-07-20 Thread christopher . henk
try adding: print "current block:", one_char_box print "zeros: ", zero_count to the lines just below your if statement that you think is called only once. This way you know how many times its called and you might be able to find the error. Chris Henk Allison Transmission phone: 317.242.2569

Re: [Tutor] class question

2007-07-13 Thread christopher . henk
However if you try to withdraw any money after you took out the $25 it would raise the error. The overdrawn function checks if you are in the negatives. Since the balance is checked before the money is taken out, there is no error when you take out the $25. If you wan the error to be raised whe