Write a program to accept a tuple, extract the last string item of the tuple and return the string after removing the first character of the string.
def last_str_from_tuple(tup): for el in tup[::-1]: if type(el)==str: return el[1:] return None tup = ("a","abc", 123, [1,2,3], "python", 456) print(last_str_from_tuple(tup))
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Comments