[Tutor] Python Variables Changing in Other Functions

2011-05-24 Thread Rachel-Mikel ArceJaeger
Hello, I am having trouble with determining when python is passing by reference and by value and how to fix it to do what I want: I am writing a program that will take in a list of book titles and will allow many people to rank them in terms of popularity and will export the results to Excel.

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Rachel-Mikel ArceJaeger
I'm not quite certain I understand. When you say sections, do you mean different worksheets? If so, you should finish writing on one worksheet first, and then move to another. If you're talking about writing to row 5, and then jumping to row 50, enumerate lets you do that by allowing you to dete

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-25 Thread Rachel-Mikel ArceJaeger
raw_input("Name and Extension of File: ") myFile = open( filename ) titles = [title in myFile if title not in ["\n",""]] return titles -- Rachel On May 25, 2011, at 6:29 PM, Wayne Werner wrote: >

Re: [Tutor] Python Variables Changing in Other Functions

2011-05-26 Thread Rachel-Mikel ArceJaeger
Yes it does! Thank you. Rachel On May 25, 2011, at 8:34 PM, Wayne Werner wrote: > On Wed, May 25, 2011 at 10:17 PM, Rachel-Mikel ArceJaeger > wrote: > You asked for the traceback. All I get is this: > - > > python a2.py > File "a2.py", l

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Rachel-Mikel ArceJaeger
A couple small things that will help improve memory management Rather than avg = sumall / count; return avg; Just return sumall/count instead. Then you don't have to waste a register or assignment operation. Division is expensive. Avoid it when you can. Here, for (a=0; a != count; a++) {

Re: [Tutor] Python Extensions in C

2011-05-26 Thread Rachel-Mikel ArceJaeger
make a difference. I recall one program I wrote where changing things little things like division and eliminating extra variables that we don't think of as being time-expensive drastically lessened the runtime. Rachel On May 26, 2011, at 10:40 AM, Alan Gauld wrote: > "Rache

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread Rachel-Mikel ArceJaeger
Isn't one of the unsolved millenium prize problems one that includes the ability to find all of the prime numbers? I'm not sure if your program is possible if the input number is large. But to check if a number x is an int, just do this: x == int(x) Rachel On May 31, 2011, at 2:23 PM, Hans

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread Rachel-Mikel ArceJaeger
Isn't one of the unsolved millenium prize problems one that includes the ability to find all of the prime numbers? I'm not sure if your program is possible if the input number is large. But to check if a number x is an int, just do this: x == int(x) Rachel On Tue, May 31, 2011 at 2:38 PM, Hug

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread Rachel-Mikel ArceJaeger
Isn't one of the unsolved millenium prize problems one that includes the ability to find all of the prime numbers? I'm not sure if your program is possible if the input number is large. But to check if a number x is an int, just do this: x == int(x) Rachel On May 31, 2011, at 2:23 PM, Hans