Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python help pleae assignment 3 into Python. The function should be called num roman.py that convert:s integers between 1 and 3999 into Roman numerals. The

python help pleaeimage text in transcribed

assignment 3 into Python. The function should be called "num roman.py" that convert:s integers between 1 and 3999 into Roman numerals. The input will be a scalar number and it should output a string that is the Roman numeral representation of the input number. The function should give a meaningful error message if the input is less than one. The function should truncate a fractional value to an integer. Different meaningful error messages should occur if you enter a value greater than 3999 or the value is not a scalar. If no input is entered it should return the Roman numeral for 2018 For legitimate values the function should build up a string as follows where x is the input: while (x>-1000) subtract 1000 from x and concatenate 'M' to the string if (x>-900) subtract 900 from x and concatenate 'CM' to the string if (x>-500) subtract 500 from x and concatenate 'D' to the string if(x>=400) subtract 400 from x and concatenateCD, to the string while (x>=100) subtract 100 from x and concatenate "C, to the string if (x>-90) subtract 90 from x and concatenate 'XC' to the string if(x>-50) subtract 50 from x and concatenate to the string if(x>=40) subtract 40 from x and concatenate XL, to the string while (x>-10) subtract 10 from x and concatenate 'X' to the string if(x>-9) subtract 9 from x and concatenate 'IX' to the string if(x>=5) subtract 5 from x and concatenate V' to the string if (x>-4) subtract 4 from x and concatenate 'IV' to the string while (x>-1) subtract 1 from x and concatenate 'I' to the string Concatenate means to add text to the end of a current string (no spaces!)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions