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

PLEASE HURRY FAST!!! Jim is building a pen for his puppy. His puppy has an area of 127 square feet. Which is the best estimate for the number of feet of fencing
Write an expression to describe the sequence below. Use n to represent the position of a term in the sequence, where n = 1 for the first term.–77, –76, –75, –74
b) An earthed conductor was brought near the charged student. A spark jumped between the conductor and the student. The potential difference between the conduct
(1) When we call someone “pig” or “swine,” we do not mean it as a compliment. (2) But pigs do not deserve to be used as a symbol for an insult. (3) They are pro
-15p+32p please awnser its rsm hw
What is this phrase in English? "Mi madre es muy inteligente."
Quick Math Question for 50 Points! Anybody willing to help? If so, brainliest plus huge thanks! :D Eight less than the product of three and a number is the same
how many molecules of oxygen is in water
PLEASE HELP!! Whats the lifestyle or entertainment in The Odyssey? (I need it for a newspaper project so please answer w a good explanation)
Write the slope-intercept form of the equation of the line through the given point with the given slope. through: (2,-2), slope = -5/6