Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function called 'return_list that takes a string as a parameter and returns a list of words in the string. Words are entities that
Write a function called 'return_list that takes a string as a parameter and returns a list of words in the string. Words" are entities that are seperated by either commas or spaces). In case the string contains neither commas nor spaces, the string will be returned without any manipulation. Note: We are not testing for the case where both commas and spaces are present in the string so feel free to ignore that. Example Input: Enter the string: this is a string Output: [this, is, a, string1 Input: Enter the string: Pranshu,Enbody,Alireza Output: ['Pranshu, Enbody, Alireza] Python 3.5 Code ##function 1 3 def main: 4 'return-list ' goes here the_string input("Enter the string:") result - return_list(the_string) print(result) 7 8 main() Expand
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