Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. def number_names(input_number):
  2.  
  3. num = str(input_number)
  4. magnitude = len(num)
  5.  
  6. if magnitude == 1:
  7. return f"{number_dict['single'][int(num)]}"
  8. if magnitude == 2:
  9. return f"{check_tens(num)}"
  10. if magnitude == 3:
  11. x, y = check_hundreds(num)
  12. return f"{x}{y}"
  13. if magnitude == 4:
  14. x, y = check_hundreds(num[1:])
  15. return f"{number_dict['single'][int(num[0])]} Thousand {x}{y}"
  16. if magnitude == 5:
  17. x = check_tens(num[:2])
  18. y, z = check_hundreds(num[2:])
  19. return f"{x} Thousand {y}{z}"
  20. if magnitude == 6:
  21. a, b = check_hundreds(num[:3])
  22. x, y = check_hundreds(num[3:])
  23. return f"{a}{b} Thousand {x}{y}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement