Question
Answer it by Python program Write a function wolfie2arabic() that takes one string argument, numerals, consisting of properlyformatted Wole numerals. Your function should return the
Answer it by Python program
Write a function wolfie2arabic() that takes one string argument, numerals, consisting of properlyformatted Wole numerals. Your function should return the integer represented by the Wole numerals. The converted integer is guaranteed to be in the range [1, 63]. Process the input string from left-to-right, looking for combinations of numerals (possibly indicating subtraction) or single numerals that are not involved in subtraction. Add the value of the numeral combination or singleton to a running total and move on to the remainder of the input string. To nd combinations of numerals, consider two characters simultaneously (e.g., IE or ES), taking care not to overrun the end of the string while doing this (an index out of range error). Proceed in this manner until the rightmost numeral has been processed.
Example:
FunctionCall ReturnValue
wolfie2arabic(EII) 10
wolfie2arabic(EFII) 14
wolfie2arabic(EEFII) 22
wolfie2arabic(ETF) 28
wolfie2arabic(ETFII) 30
wolfie2arabic(TEEFII) 54
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started