In: Computer Science
Python 1.)Assume that name is a variable of type String that has been assigned a value. Write an expression whose value is the last character of the value of name. So if the value of name were "Blair" the expression's value would be 'r'. 2.)Assume that word is a variable of type String that has been assigned a value. Write an expression whose value is a String consisting of the last three characters of the value of word. So if the value of word were "biggest" the expression's value would be "est".
# this function returns #the last character of string def last_character(name): return name[-1] #this function return last three characters # of a string if length of that string is >3 # else return the string def last_three_characters(name): if len(name)>=3: return name[-3:] return name print(last_character("Blair")) print(last_three_characters("biggest"))