""" Solve the fifth problem. """ print "\n\n# Problem #5 : print the first K odd number." K = 5 print "First answer (with a for loop, by printing the integers, one by one):" for i in range(1, 2*K, 2): print i print "Pretty answer (with a for loop, by concatenating the integers to the string, step by step):" s = "" for i in range(1, 2*K, 2): s = s + str(i) + " " # We add that integer to the string print s print "Shorter answer: (' '.join([str(i) for i in xrange(1, 2*K, 2)]))" print " ".join([str(i) for i in xrange(1, 2*K, 2)]) print "Done"