Question: How to create a new list with a specific format from an existing list? Write a code for the following example: >>> greetings_old = ['5,9,BYE',
How to create a new list with a specific format from an existing list?
Write a code for the following example:
>>> greetings_old = ['5,9,BYE', '7,5,HI'] >>> greetings_new(greetings_old) [[7, [5], []], [5, [], [9]]]
So the input formate is ['str, str, str' , 'str, str, str']
So the output format should be: [[number, [number of HI], [number of BYE]]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
