number = 547
nums = {1:"one", 2:"two",3:"three",4:"four",5:"five",6:"six",7:"seven",8:"eight",9:"nine"}
print("The last digit of",number,"is",nums[number%10])
I wrote my code in python 3.8. I hope this helps.
3.5m questions
4.5m answers