"Rachel-Mikel ArceJaeger" <arcejae...@gmail.com> wrote

I'm not sure I like this one much...

def rank( randomizedTitles, dictOfTitles ):
""" Gets a user-input ranking (0-10) for each line of text. Returns those rankings """ for title in randomizedTitles: while True: rank = raw_input(title + " ") if not rank.isdigit():
               continue
           elif ( int(rank) > 10 ):
               continue

I'd have made the while test do the checking:

rank = ''
while (not rank.isdigit() ) or ( int(rank) > 10 ):
      rank = raw_input(....)

And I'd have put the next line outside the while
dictOfTitles[title].append(rank)

And you then don't need the break
           break

Just an opinion though,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to