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

How do I print the word that is chosen from this function from PS2? I tried print choose_word and got: def choose_word(wordlist): """ wordlist (list): list of words (strings) Returns a word from wordlist at random """ return random.choice(wordlist)

OpenStudy (espex):

You need to do one of two things. 1. Assign the return value to a variable and print that variable: rand_word = choose_word(wordlist) print (rand_word) 2. Feed the return value to the print command: print (choose_word(wordlist))

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!