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

The pituitary gland is controlled by sex hormones True or False.
what is a point represented by?
What is the value of x?
According to this excerpt, how has Odysseus changed over the course of his adventure? He has become more humble and patient in battle. He has learned to play th
How are the archetypes presented in these two passage different
Your friend Kayla is starting her own business and asks you whether she should set it up as a P2P network or as a client-server network. List three questions yo
What is this bug called?
A Diana les gustan patinar con ustedes. A Diana le gusta patinar contigo. A Diana le gusta patinar con ustedes. A Diana le gusta correr con ustedes.
Read the excerpt from A Christmas Carol by Charles Dickens and answer the question. Scrooge has just seen the face of his dead business partner Marley in the do
Read this excerpt from a personal letter. Which two instances of conflict does it contain? I found a rare comic in my attic. It belonged to my grandfather. It w