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.

Relax

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

what property is p=0+p
The table contains data on the number of females graduating from an engineering program each year, starting with the inaugural year, year 0. Using your Scatter
list fractions and decimals in order from least to greatest 2.3, 24\5,2.6
What is the prime factorization of 81
If two organisms share the same kingdom, must they also share the same domain
What number goes into 24 and 100
what is the answer to these question 1:1/3y-1/2=5 2:5n+1/2=1/6
What's 2.54 in a fraction
In 10 minutes, a heart can beat 700 times. At this rate in how many minutes will a heart beat 140 times? At what rate can a heart beat?
The table contains data on the number of females graduating from an engineering program each year, starting with the inaugural year, year 0. Using your Scatter