I got a program that converts Roman numerals to integers and vice versa. My problem is that I don´t really know how to create a function that checks if the user input is a v
def checkIfRomanNumeral(numeral):
"""Controls that the userinput only contains valid roman numerals"""
numeral = numeral.upper()
validRomanNumerals = ["M", "D", "C", "L", "X", "V", "I", "(", ")"]
valid = True
for letters in numeral:
if letters not in validRomanNumerals:
print("Sorry that is not a valid roman numeral")
valid = False
break
return valid
Returns a boolean whether the given 'numeral' is roman numeral or not.