Example:
tuple = ("python", "includehelp", 43, 54.23)
Now, let's get back to our topic of extracting even indexed elements in Tuple.
Removing space between tuple elements
For this, we will traverse the tuples and remove the spaces while printing them.
Method 1:
To remove the extra space between tuples, we will simply use the replace() method which will replace the space between elements of tuple and then convert it string using the str() method.
Output:
Method 2:
One more method to solve the problem is by removing the extra space from the tuple by using the join() method and then map it using the map() method.
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer