#! /usr/bin/env python # -*- coding: UTF-8 -*- """ Latin number: programma in python creato da TheFox This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. """ # Descrizione del file __module_name__ = "Latin number" __module_version__ = __revision__ = versione = "0.3" __module_description__ = "Converte i numeri decimali in numeri latini" # Inizializzazione mind=[0,"unus","duo","tres","quattuor","quinque","sex", "septem","octo","novem","decem","undecim","duodecim","tredecim", "quattuordecim","quindecim","sedecim","septendecim"] unit=["","unus","duo","tres","quattuor","quinque","sex", "septem","duode","unde"] decin=["","","viginti","triginta","quadraginta","quinquaginta","sexaginta","septuaginta", "octoginta","nonaginta","centum"] cent =["","centum","duecenti","trecenti","quadringenti","quingenti","sescenti", "septingenti","octingenti","nongenti"] print # Inserimento numero i = 0 while i != 1: try: n = int(raw_input("Nvmero > ")) i = 1 except: print "\nNumero non valido. Riprova." # Calcolo c = int (n/100) d = int(n/10)-c*10 u = n-(int(n/10)*10) # Output if n<=17: print mind[n] elif (u == 8) or (u == 9): print cent[c],unit[u]+decin[d+1] else: print cent[c],decin[d],unit[u]