Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 21 Online
OpenStudy (anonymous):

OK...stumped! PS5, is_valid_word: take a look please, I'm baffled. http://codepad.org/FfxIEyAY It doesn't want to compare the word 'eel' or 'ray' which are in variable hand1. Then I randomly tried 'word' and it passed the "word test". Please tell me what's going on

OpenStudy (anonymous):

if i use the compiler(interpreter).... >>> 'eel' in word_list True wtf?

OpenStudy (anonymous):

Ok...so 'word' works simply because it's reading word_list as a string comprised of 'C:\\Python27\\Doc\\words.txt'. just as '\\Pyt' is also in this string. So clearly my variable link to the text file is inadequate....still I don't know the difference as it loads the words when I restart the shell

OpenStudy (anonymous):

From assignments, download ps5.py. In ps5.py you will find the load_words function. is_valid_word will take thee arguments: word, hand, and word_list. word_list is produced by load_words

OpenStudy (anonymous):

Did you get your code working?

OpenStudy (anonymous):

http://dpaste.com/672230/

OpenStudy (anonymous):

thats much prettier than my version, but mine works too!

OpenStudy (anonymous):

post it kiddo

OpenStudy (anonymous):

Ok, but I warned you... it isn't as pretty... lol http://codepad.org/zsalgxPh

OpenStudy (anonymous):

looks like it works and you're using the in operator so looks good to me

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!