-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathroman_numbers.py
57 lines (48 loc) · 1.49 KB
/
roman_numbers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
Module Docstring
"""
__author__ = "Python Group Da Nang"
__version__ = "0.1.0"
__license__ = "MIT"
from subprocess import call
# All our lists
error_list =["0","1","2","3","4","5","6","7","8","9"]
valid_list = ["I","X","C","M","V","L","D"]
aux_characters = ["V","L","D"]
basic_characters = ["I","X","C","M"]
convert_character ={"I": 1,"X":10,"C":100,"M":1000,"V":5,"L":50,"D":500}
total = 1
def subtract_aux_check(characters):
# Convert characters to a list
#total = 0
print(total)
for character in characters:
print("Value of total ", total)
total = total + convert_character[character]
print("Total is ",total)
#number_of_items = len(characters)
def check_symbols(characters):
#print(type(characters))
print("Check Symbols ", characters)
# Check no number
for character in characters:
print(character)
if character in error_list:
print(" Please don't use Arabic numbers")
break
elif character not in error_list and character in valid_list:
subtract_aux_check(characters)
elif character not in valid_list:
print(" Only these characters are valid I,V,X,L,C,D,M ")
break
"""
def main(characters):
Main entry point of the app
check_symbols(characters)
while True:
characters = input("Type in the Roman number: ")
main(characters)
"""
characters = input("Type in the Roman number: ")
check_symbols(characters)