kevinbaldridge9902 kevinbaldridge9902
  • 12-11-2020
  • Computers and Technology
contestada

Write a function named last_digit that returns the last digit of an integer. For example, last_digit(3572) should return 2. It should work for negative numbers as well; last_digit(-947) should return 7.

Respuesta :

Cytokine
Cytokine Cytokine
  • 12-11-2020

def last_digit(num):

   num = str(num)

   return int(num[-1])

print(last_digit(-947))

I hope this helps!

Answer Link

Otras preguntas

The "control center" for the pituitary gland is the: master gland thyroid parathyroid hypothalamus
Think back to the question you considered at the beginning of the lesson. Based on what you learned, do you think the United States was justified in its decisio
WHAT DOES IT MEAN WHEN YOU HAVE BROWN DISCHARGE WITH BLOOD AND WHEN YOU WIPE THERE'S BLOOD BUT IN THE PAD THE BLOOD IS BROWN? THIS QUESTION IS NOT ABOUT ME OR A
2 divided by 1/4 =8 because ___times 1/4=2.
How does ATP study energy for cellular activities?
After Constantine died who replaced him
how do I do these!?!
Select the correct answer. What is the approximate average rate of change of the function p(x)=(6x-4)/x on the interval [1,3]?
Which type of volcanoes would be the least explosive
Identify the poet of each of the following quotations by writing the corresponding letter on the blank line.A) Robert Herrick B) Edmund Spenser C)John Donne D)