LU08.L02: Syntaxfehler-2

def run():
    decimals = [1, 4, 5, 9, 10, 40, 50, 90,
                100, 400, 500, 900, 1000]
    numerals = ["I", "IV", "V", "IX", "X", "XL",
                "L", "XC", "C", "CD", "D", "CM", "M"]
    position = 12
 
    number = user_input()
    while number:
        div = number // decimals[position]
        number %= decimals[position]
 
        while div:
            print(numerals[position], end="")
            div -= 1
        position -= 1
 
 
def user_input():
    input_string = input('Natürliche Zahl > ')
    while not input_string.isdigit():
        input_string = input('Eingabe muss eine natürliche Zahl sein > ')
    return int(input_string)
 
 
if __name__ == '__main__':
    run()
  • modul/m319/learningunits/lu08/loesungen/noten_fehler.txt
  • Zuletzt geändert: 2024/03/28 14:07
  • von 127.0.0.1