Question

Complete the Python function to return the last n characters of a string s. If n is greater than the string's length, return the entire string. def get_last_n_chars(s,
n):     _________ # Line to complete

A return s[len(s)-n:]
B return s[-n:]
C return s.substring(len(s)-n)
D return s.slice(-n)
E return s[max(1, len(s)-n):]
Practice Next

Hey! Ask a query