5

Help converting an if loop into a while loop?

view full story
linux-howto

http://www.daniweb.com – the program I had looks like this: def wordToNumber(word): if word == "one": return 1 elif word == "two": return 2 elif word == "three": return 3 elif word == "four": return 4 elif word == "five": return 5 elif word == "six": return 6 elif word == "seven": return 7 elif word == "eight": return 8 elif word == "nine": return 9 elif word == "ten": return 10 but since my professor is hella strict he's like...yes that works...but I'd like it in a while loop. the .....monstrosity....that I've come up with so far that I know is completely wrong but bear with me im learning...and he's not that great of a teacher.... def wordToNumber(word): wordList = ["zero","one","two","three",...,"nine"] while word in wordList: wordList == range(10) print i in range(10) :D...aha....yeah I know. fail....but all I need is someone to show me the proper way and then maybe i can learn not to be such a fail....lol. please help me? (General)