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

BONJOUR, J'AI DES EXOS DE MATHS POUR LUNDI, POUVEZ-VOUS M'AIDER ???
I NEED HELP PLEASE I NEED IT SOON 1. What are the three perspectives on religion? Describe each. Which one do you think offers the best explanation for the exis
You want to buy a 11-year bond with a maturity value of $12,000, and you wish to get a return of 7.25% annually. How much will you pay? (Round your answer to th
(Look at picture)………..
Which logic gate is the diagram showing? A O AND OOR O NOT O NOR * 1 point out
education act #49 s 2022 argumentative essay for eng po please help​
Divide R240 in the ratio 2:3?
What is the binary code for line 7? * 크 O 101000010 01000010 00111100 1 poin O 10111101 helpppp
Is buffy or Bonnie correct?l
Hiro tests the efficiency of the lab’s autoclave and blood gas analyzer. He adjusts the machines when necessary so that test results will come out as accurately