Hi, Ken. I ran the program code you had put in your email.It wasn't the affect I wanted. I was making a program which produced the sequence 2, 4, 7, 10, 14, 18, 23, 28, 34, 40 and so on. In other words, you notice for the first two digits 2, and 4 it skips by two. For the second set of numbers 7, and 10 it skips by three. For 14, and 18 it skips by four, and so on. I had succeeded in making such a program. I had mistakenly put two equal signs in the statements after the "if count == new_count" statement. I got rid of the extra equal signs and now the program works perfectly. Gilbert Neiva ----- Original Message ----- From: Ken Perry To: programmingblind@xxxxxxxxxxxxx Sent: Sunday, May 18, 2008 7:55 PM Subject: RE: Python programming problem Gilbet why are you using so many variables? If you can't use recursion you could do it this way. If you can use recursion you could get this even smaller. #The following program will calculate the following math sequence #2 4 7 10 14 18 23 28 and so on. #value is the value you want to print starts at 0; value=0 #index Is the addition index starts at 2 index=2 #old index is the previous index starts at 1 old_index=1 while index < 30: #The above line while index < 30 #tells the program to loop until the variable #index reaches 30 #the if statement checks to see if we have already added this index #if we have added this current index value we add it again and increment the index # if we have not we add the index to the value and increment the old_index if old_index == index: value+=index index+=1 else: value+=index old_index+=1 #The following line will display the value #As the program loops, the output will not go line by line print value, ------------------------------------------------------------------------------ From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Gilbert Neiva Sent: Sunday, May 18, 2008 6:30 PM To: programmingblind@xxxxxxxxxxxxx Subject: Re: Python programming problem Thanks. It worked. I always thought that in an if statement, you always need two equal signs if something equaled something else. But I got rid of the extra equal signs and the program works the way I want it to now. It produces the right sequence of numbers. Gilbert Neiva ----- Original Message ----- From: rrdinger To: programmingblind@xxxxxxxxxxxxx Sent: Sunday, May 18, 2008 5:52 PM Subject: Re: Python programming problem Hi Gilbert, I'm not certain exactly what sequence you are trying to produce, but I think the statements you have in your if block are probably wrong. You have: if count == new_count: new_count == new_count+2 c == c+1 Those two statements are comparisons and result in either True or False, you probably want: if count == new_count: new_count = new_count+2 c = c+1 A handy short hand for such statements is: if count == new_count: new_count += 2 c += 1 HTH Richard ----- Original Message ----- From: Gilbert Neiva To: programmingblind@xxxxxxxxxxxxx Sent: Sunday, May 18, 2008 10:38 AM Subject: Python programming problem I am trying to make a program that makes the math sequence 2, 4, 7, 10, 14, 18, 23, 28 and so on. But when I run the program it does the math sequence 2, 4, 6, 8, 10 and so on. Here is the program code below. #The following program will calculate the following math sequence #2 4 7 10 14 18 23 28 and so on. #The following lines will create three variables a, b, and c with #values of 2, 0, and 0 a = 2 b = 0 c = 0 #The following line will create a variable count #with a value of 0 count = 0 #The following line will create a variable new_count #with a value of 2 new_count = 2 #The following line will create a variable max_count #with a value of 30 max_count = 30 while count < max_count: #The above line while count < max_count: #tells the program to loop until the variable #count reaches 30 #The following line will create a variable d #witch will equal the formula a+b+c d = a+b+c #The following line will make b equal to d #as the program runs, the values within these two variables will change b = d #The following line will increase the variable count by 1 #each time the program loops count = count+1 #The following if statement will tell the program to increase #the new_count variable by 2 and the c variable by 1 #if the count variable is equivalent to the new_count variable if count == new_count: new_count == new_count+2 c == c+1 #The following line will display the value of d #As the program loops, the output will not go line by line print d, What am I doing wrong? Gilbert Neiva