1. def different(a, b): return a != b Note the following does the same thing, but is NOT as good: def different(a, b): if a == b: return False else: return True (or other ways with an if statement). Notice that the top definition is MUCH more concise. 2. You can emulate any for loop with a while loop by introducing a new variable for counting up the number of iterations. You initialize it before the loop, use < to check the number of iterations, and at the end of the while loop you increment the counter by 1. def my_sum(n): total = 0 i = 1 while i < n+1: total += i i += 1 return total