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!
Tweedledee and Tweedledum, the twin brothers, are fascinated by Python, not the snake, but the programming language! They wanted to challenge anyone trying to enter Wonderland.
One bright afternoon, while wandering through a dense forest of syntax and logic, they had an idea. Tweedledee, always the more straightforward of the two, said, "I want to see if the students can master the art of slicing. It's a very important Python skill!"
Write a function first_last(word) that given a string word returns a tuple containing (a,b,c) where a is its first character, b is its last character and c is the remainder of the word without the first and last characters.
The following limits are guaranteed in all the test cases that will be given to your program:
2 ≤ |word| ≤ 100 | size of the input string |
Example Function Calls | Example Output |
print(first_last("python")) print(first_last("oh")) print(first_last("123456")) |
('p', 'n', 'ytho') ('o', 'h', '') ('1', '6', '2345') |