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

This equation has one solution. 3(x – 2) + 4x = 10(x + 1) What is the solution?
i don’t know how to answer this so look at the pic
which character best represents the colonizer in the tempest​
Match each wave characteristics to its description
air blows at the base of circulation cells from ________ pressure to ________ pressure
Explain the genotype and phenotype of the skin color. Summarize the relationship between the number of active genes and color of the skin.
Anyone know this please help
The action you would use to solve x/3=12, and the property that justifies that action
How does crystal violet enhance the visualization of bacterial structure(s)?
What challenges did Americans building the Panama Canal?​