Write a python program 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 Enter a word (or ‘q’ to quit): Dingo Enter a word (or ‘q’ to quit): Platypus Enter a word (or ‘q’ to quit): q Wallaby

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question
100%

Write a python program 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 Enter a word (or ‘q’ to quit): Dingo Enter a word (or ‘q’ to quit): Platypus Enter a word (or ‘q’ to quit): q Wallaby

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning