In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of November 9th
(this exercise will still be available for submission after that deadline, but without counting towards your grade)
[to understand the context of this problem, you should read the class #05 exercise sheet]
In this problem you should submit a function as described. Inside the function do not print anything that was not asked!
Ah, just when you thought you were done with the twins and their endless challenges, out of thin air, the Cheshire Cat appeared with that famous, mischievous grin of his!
Perched on a nearby tree branch, he chuckled softly and said, "You’ve handled Tweedledee and Tweedledum quite well. But now, I have a little task of my own. I’m very fond of duplicates. They amuse me... So, let’s see if you can handle this!"
Write a function duplicate(tup) that given a tuple tup returns a new tuple that has all its values duplicated. For instance the tuple (1,2,3) should give origin to the tuple (1,1,2,2,3,3,)
The following limits are guaranteed in all the test cases that will be given to your program:
1 ≤ |tup| ≤ 100 | size of the input tuple |
Example Function Calls | Example Output |
print(duplicate( (1,2,3) )) print(duplicate( ("python","rocks") )) print(duplicate( (1.0, True, 4, "a") )) |
(1, 1, 2, 2, 3, 3) ('python', 'python', 'rocks', 'rocks') (1.0, 1.0, True, True, 4, 4, 'a', 'a') |