Write a function that takes an integer as input argument and returns the integer using words. For example if the input is 4721 then the function should return the string "four seven two one". Note that there should be only one space between the words and they should be all lowercased in the string that you return.
this is my code:
def Numbers_To_Words (number):
dict = {1: "one", 2: "two", 3: "three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 0: "zero"}
output_str = " "
list = []
#Main Program
number = 4721
result = Numbers_To_Words (number)
print (result)
My question is, How do I separate the numbers and then compare with the dictionary I have created? I know length doesn't work on integer data type. I know the further logic that is to send keys to the dictionary and obtain their respective value. But before that I am stuck here in separating digits of an integer number.