Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function reverse(s) that takes a string as an argument and returns a new string with all of the characters reversed. Example usage: >>>

Write a function reverse(s) that takes a string as an argument and returns a new string with all of the characters reversed. Example usage: >>> a_str = 'abcde' >>> r_str = reverse(a_str) >>> print r_str edcba

Design and implement a function for converting an integer into Roman numerals (a string). The rules for Roman Numerals involve using four pairs of symbols for ones and five, tens and fifties, hundreds and five hundreds. An additional symbol for thousands covers all the relevant bases. When a number is followed by the same or smaller number, it means addition. "II" is two 1's = 2. "VI" is 5 + 1 = 6. When one number is followed by a larger number, it means subtraction. "IX" is 1 before 10 = 9. "IIX" isn't allowed, this would be "VIII"

For example, 1994 converts to 'MCMXCIV', 1956 converts to 'MCMLVI', and 3888 converts to 'MMMDCCCLXXXVIII'

NOTE: you may NOT use data structures (lists, tuples, or dictionaries) that have not been covered prior to when this homework is released

Draw a flowchart representing the design of your function. Submit the flowchart diagram in a file named homework8_fc.pdf

Implement a function int_to_roman(num) that converts the integer argument to a Roman numeral and returns a string representation of that Roman numeral.

Use the Test Plan Template to document test cases for both functions. Test cases should include the critical inputs for each function. When it comes to writing these test cases, a great place to look for help would be the testing programs from the project parts. Save this as homework8_test_plan.pdf For example:

The reverse function should work correctly for strings of different lengths.

Critical values for Roman numeral conversion include (but are not limited to) multiples of 4 and 9.

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

Question

What information remains to be obtained?

Answered: 1 week ago

Question

4. Who should be invited to attend?

Answered: 1 week ago

Question

7. How will you encourage her to report back on the findings?

Answered: 1 week ago

Question

Were the decisions based on appropriate facts?

Answered: 1 week ago