Advertisement
Rementai

Liczba na napis

Mar 9th, 2023
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.45 KB | None | 0 0
  1. def number_to_word(word):
  2.     dic = {
  3.         '0': 'zero',
  4.         '1': 'jeden',
  5.         '2': 'dwa',
  6.         '3': 'trzy',
  7.         '4': 'cztery',
  8.         '5': 'pięć',
  9.         '6': 'sześć',
  10.         '7': 'siedem',
  11.         '8': 'osiem',
  12.         '9': 'dziewięć'
  13.     }
  14.  
  15.     result = ""
  16.  
  17.     for letter in word:
  18.         if letter.isdigit():
  19.             result += dic[letter] + " "
  20.  
  21.     return result[:-1]
  22.  
  23. print(number_to_word('1410'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement