Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following functions. Def firstDigit(n) (returning the first digit of t

ID: 3680349 • Letter: W

Question

Write the following functions. Def firstDigit(n) (returning the first digit of the argument) def lastDigit(n) (returning the last digit of the argument) def digits(n) (returning the number of digits of the argument) For example, firstDigit(1729) is 1, lastDigit(1729) is 9, and digits (1729) is 4. Provide a program that tests your functions. Write a function def middle(string) that returns a string containing the middle character in string if the length of string is odd, or the two middle characters if the length is even. For example, middle ("middle") returns "dd". Write a function def repeat(string, n, delin) that returns the string string repeated n rimes, separated by the string delim. For example, repeat ("ho", 3, ",") returns "ho, ho, ho".

Explanation / Answer

P5.3....

def first digit(n):

P5.4...