Write a function called first_and_last that takes a string as input.
first_and_last
The function should return a new string made up of:
Examples:
first_and_last("Python") # returns "Pn" first_and_last("cat") # returns "ct" first_and_last("a") # returns "aa"
try
except
raise
def divide(a, b): if b == 0: raise ZeroDivisionError("You can’t divide by zero!") return a / b print(divide(10, 2)) print(divide(10, 0)) # raises ZeroDivisionError
ValueError
TypeError
ZeroDivisionError
def set_age(age): if age < 0: raise ValueError("Age cannot be negative") return age
x = -5 if x < 0: raise ValueError("x must not be negative")
def square_root(n): if n < 0: raise ValueError("Cannot take square root of negative number") return n ** 0.5
Write a function get_grade(score) that:
get_grade(score)