Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def number_names(input_number):
- num = str(input_number)
- magnitude = len(num)
- if magnitude == 1:
- return f"{number_dict['single'][int(num)]}"
- if magnitude == 2:
- return f"{check_tens(num)}"
- if magnitude == 3:
- x, y = check_hundreds(num)
- return f"{x}{y}"
- if magnitude == 4:
- x, y = check_hundreds(num[1:])
- return f"{number_dict['single'][int(num[0])]} Thousand {x}{y}"
- if magnitude == 5:
- x = check_tens(num[:2])
- y, z = check_hundreds(num[2:])
- return f"{x} Thousand {y}{z}"
- if magnitude == 6:
- a, b = check_hundreds(num[:3])
- x, y = check_hundreds(num[3:])
- return f"{a}{b} Thousand {x}{y}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement