Problem 2 Write a program called p2.py that contains a function called word selection () that takes a list as a parameter and randomly selects one item in the list and prints it. Your program should...


Problem 2<br>Write a program called p2.py that contains a function called word selection () that takes a<br>list as a parameter and randomly selects one item in the list and prints it. Your program should<br>have the following functionality:<br>1. Continuously prompt the user to enter a word until the user enters q<br>2. Store the entered words in a list<br>3. Making use of the random module, your program should call word selection () that<br>randomly selects a word from the list and prints it<br>4. Include the guard for the main function:<br>if<br>name<br>main<br>':<br>==<br>main()<br>Example:<br>Enter a word (or 'q' to quit): Wallaby<br>to quit): Dingo<br>Enter a word (or 'q'<br>Enter a word (or 'q' to quit): Platypus<br>Enter a word (or 'q' to quit): q<br>Wallaby<br>

Extracted text: Problem 2 Write a program called p2.py that contains a function called word selection () that takes a list as a parameter and randomly selects one item in the list and prints it. Your program should have the following functionality: 1. Continuously prompt the user to enter a word until the user enters q 2. Store the entered words in a list 3. Making use of the random module, your program should call word selection () that randomly selects a word from the list and prints it 4. Include the guard for the main function: if name main ': == main() Example: Enter a word (or 'q' to quit): Wallaby to quit): Dingo Enter a word (or 'q' Enter a word (or 'q' to quit): Platypus Enter a word (or 'q' to quit): q Wallaby

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here