Question
USING PYTHON: A2) List Comprehension - String. Write a program that has 3 functions. The first function would ask for a user to enter a
USING PYTHON:
A2) List Comprehension - String. Write a program that has 3 functions. The first function would ask for a user to enter a word and it will save the word into a list then ask for next word to append to the list. Continue the process of word entry until user enter Q to stop data entry into the list. The function should return the list of words entered by user. (Example of words "democratic", "republican", "equal", "python", "break", "two", "ruby").
The second function will take a word as its argument and make it in upper case. The function returns this upper-case word.
The third function will take the list of words (output from first function) as an input argument then it creates a new list through list comprehension and using the second function to create new word list where all words are in upper-case. The function will return new upper-case-word list. The final step is to display third function output (print that new list). (Use list comprehension)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started