Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program that converts Roman numbers python In Python 3.6 Write a program that converts a Roman number such as XXLMCVIIMI to its decimal

write a program that converts Roman numbers python
image text in transcribed
In Python 3.6 Write a program that converts a Roman number such as XXLMCVIIMI to its decimal number representation. Hint: First write a function that vields the numeric value of each of the letters. Then use the following algorithm total-0 While the roman number string is not empty If value(first character) is at least value(second character), or the string has length Add value(first character) to total. Remove the character Else Add the difference, value(second character)- value(first character), to total. Remove both characters. 1. Get user input from a separate function and returns the input to the main program. The prompt should be as follows: "Please input a Roman number:" (Do not include the quotes.) Name this function: getinputO 2. Perform the algorithm as given within a separate function that is passed the Roman Number and returns the numeric value to the main program. Name this function: calculate Value) 3. Output the answer using a separate function that is passed the numeric value and returns nothing. Name this function: displayOutput 4. The output should look as follows" "The Roman Number XI has a numeric value of 11." (Do not include the quotes.) So, you should output the original Roman number input and its numeric value. 5. Use meaningful variable names in camelcase style. No single character variable names. Your program should be using three (3) different functions to accomplish the task

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions