1. General matters
1.1. Aim. The purpose of the assignment is to:
develop your problem solving skills;
design and implement the solution to a program in the form of a medium sized Python program;
practice the use of arithmetic computations, tests, repetitions, lists, and strings.
1.2. Submission. Your program will be stored in a file named roman_arabic.py. Assignments can be submitted more than once; the last version before the due date is marked.
Your assignment is due by Monday 26 October 2020, 10:00pm (Week 7).
1.3. Assessment. The assignment is worth 15 marks. It is going to be tested against a number of inputs. For each test, the automarking script will let your program run for 30 seconds. The outputs of your programs should be exactly as indicated.
Late assignments will be penalised: the mark for a late submission will be the minimum of the awarded mark and 15 minus 1.5 times the number of full and partial days that have elapsed from the due date (that is, 10% penalty per day late).
1.4. Reminder on plagiarism policy. You are permitted, indeed encouraged, to discuss ways to solve the assignment with other people. Such discussions must be in terms of algorithms, not code. But you must implement the solution on your own. Submissions are routinely scanned for similarities that occur when students copy and modify other peopleβs work, or work very closely together on a single implementation. Severe penalties apply.
2. Description
You will design and implement a program that prompts the user for
an input with How can I help you .
User input should be one of three possible kinds:
Please convert ***
Please convert *** using ***
Please convert *** minimally
If user input is not of this form, with any occurrence of *** an arbitrary nonempty sequence of nonspace symbols, then the program should print out
I donβt get what you want, sorry mate! and stop.
2.1. First kind of input. In case the user inputs Please convert ***, then *** should be either a strictly positive integer (whose representation should not start with 0) that can be converted to a Roman number (hence be at most equal to 3999), or a valid Roman number; otherwise, the program should print out
Hey, ask me something thatβs not impossible to do! and stop. If the input is as expected, then the program should perform the conversion, from Arabic to Roman or from Roman to Arabic, and print out the result in the form
Sure! It is ***
2.2. Second kind of input. In case the user inputs Please convert *** using ***, then the first *** should be a strictly positive integer (whose representation should not start with 0) or a sequence of (lowercase or uppercase) letters and the second *** should be a sequence of distinct (lowercase or uppercase) letters.
Moreover,
the second *** is intended to represent a sequence of so-called generalised Roman symbols, the classical
Roman symbols corresponding to the sequence MDCLXVI, whose rightmost element is meant to represent
1, the second rightmost element, 5, the third rightmost element, 10, etc.;