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

If The difference of a number and ten is tripled, the result is 4 more than the number. Find the number
A farmer plants 987 apple trees in 9 rows. Can each row have the same number of trees? How do you know?​
Choisis la meilleure réponse pour compléter la phrase suivante. ___ lecteur ne lit pas les Blu-rays, mais il lit les DVD. Ce Cette Cet Ces
Write any 5 amazing facts of jarawas?? write in points.​
(−4)−(−2)–{(−5)–[(−7)+(−3)–(−8)]} please i need this done really soon
Definition of an electrically charged object
exponential 2^2/2^-3​
In if GS ⊥ XJ and XJ⊥EA what is true about GS and EA
If 8 minus some number divided by 3 = 6 what is the number?
Jeremy spent $33 on 3 CDs. At This rate. how much would 6 CDs cost ?​