Question: Create a list of a tuple based on the length of the tuple where all elements but the last element is inside the tuple and
Create a list of a tuple based on the length of the tuple where all elements but the last element is inside the tuple and the last element is another tuple. Please see my example below. The original list will have the same length inside all the tuples.
For example:
listThisIs 'The', 'First', 'List'ThisIs 'The', Second', 'List'ThisIs 'The', 'Third', 'List'
newlist ThisIs 'The', 'First' 'List'ThisIs 'The', 'Second' 'ListThisIs 'The', 'Third' 'List'
Need a dynamic way to check the length each element in the list and then create the new list in the form of
element element elementn lastelement
The list can be of n length. Therefore, need to check the length and loop through the list.
Another example:
listThisIs 'The', 'First'ThisIs 'The', Second'ThisIs 'The', 'Third'
newlist ThisIs 'The' 'First'ThisIs 'The' 'Second'ThisIs 'The 'Third'
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
