# summing up all numbers from 0 to N, using a while loop # note: in my opinion, a for loop is more simple, but the goal # of this example is to show that for loops can always be replaced # by while loops # get N from the user N_string = raw_input("please enter N: ") N = int(N_string) # compute the sum total = 0 i = 0 while i <= N: total = total + i i = i+1 # print the result print "total =", total