# summing up all numbers from 0 to N, using a for loop import number_check # get N from the user, keep asking until an integer is entered while True: my_string = raw_input("please enter N: ") if (number_check.check_integer(my_string) == False): print "string", my_string, "is not a valid integer" else: break N = int(my_string) # compute the sum total = 0 for i in range(0, N+1): total = total + i