Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please give detailed explanations beside every code. 6. Roman-ish numerals Roman numerals are slightly tricky: the same letter should not be used more than 3
Please give detailed explanations beside every code.
6. Roman-ish numerals Roman numerals are slightly tricky: the same letter should not be used more than 3 times, so 4 isn't IIII, its IV. In this part of the question, however, we will be lazy: we can use the same letter up to 4 times. Write a Python function romanish that takes an integer smaller than 1000 and returns a string representation in this lazy form of Roman numerals. Example: romanish(1) == 'I' romanish(5) == 'V' romanish(9) == 'VIIII romanish(39) == 'XXXVIIII romanish(50) == 'L' romanish(100) == 'C' romanish(500) == 'D' Try to do this question using a list/tuple. Hint: this is not too different from making change. 7. Roman numerals, the full version Write a function that converts an integer to its true Roman numeral representation: Write a Python function roman(n) that takes an integer and returns a string represen- tation. Try to use lists or dictionaries! Example: roman(1) == 'I' roman(5) == 'V' roman(9) == 'IX' roman(39) == 'XXXIX' roman(50) == 'L' roman(100) == 'C' roman(500) == 'D' roman(999) == 'CMXCIXStep 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