Python :: Aufgabe #80 :: Lösung #3
3 Lösungen

#80
Jahreszahlenkonverter für römische Schreibweise
Anfänger - Python
von BlackBird321
- 04.06.2015 um 22:36 Uhr
Bitte schreibe ein Programm, welches eine einzugebende Jahreszahl in eine römische Schreibweise umwandelt.
Beispiel:
1995 = MCMXCV
2015 = MMXV
Beispiel:
1995 = MCMXCV
2015 = MMXV
#3

von Nachbar (2820 Punkte)
- 27.08.2016 um 10:46 Uhr

# -*- coding: utf-8 -*- zahlen = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1] zahlzeichen = ["M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", \ "IV", "I"] arabisch = input("Jahreszahl Arabisch: ") roemisch = "" for i in zahlen: while arabisch >= i: roemisch = roemisch + zahlzeichen[zahlen.index(i)] arabisch = arabisch - i print "\nJahreszahl Roemisch: " + roemisch
Kommentare:
Für diese Lösung gibt es noch keinen Kommentar
Seite 1 von 0
1