diff --git a/improve_me.py b/improve_me.py index ec7fce4..5968af2 100644 --- a/improve_me.py +++ b/improve_me.py @@ -2,7 +2,7 @@ import random, getopt, sys, os # This line will only work in Python 2 -print "This script is not perfect" +print "This script is not perfect, but slightly better" # The following loop could be written in a single line with list comprehension random_numbers = [] @@ -14,10 +14,10 @@ print random_numbers[i] # This loop could be rewritten with enumerate -i = 0 -for r in random_numbers: + +for i,r in enumerate(random_numbers): print(i, r) - i += 1 # This is not C -if(len(random_numbers)>5): print("Lots of random numbers here") +if(len(random_numbers)>5): + print("Lots of random numbers here")