Python 3.5.2 Roman Numeral Quiz
<p>So I am doing this assignment for school. I have to create a quiz like game that will prompt a user to add roman numerals together and input their answer. It will then check the user's answer with the correct answer and tell the user if they got it right or wrong.</p>

<p>So far I have this:</p>

<pre><code>class RomanNumeral:
    index = 0
    while index &lt; len(integer_list) - 1:
        #if a lower number is first, it should be subtracted, like IX, 
        #the one should be subtracted, but the 10 added
        if integer_list[index] &lt; integer_list[index + 1]:
            r_integer -= integer_list[index]
        else:
            r_integer += integer_list[index]
        index += 1
    #Always add the last number
    r_integer += integer_list[index]
    #Store r_integer as an instance data item
    self.__integer = r_integer
    return

def main():
        roman1 = RomanNumeral('random')
        roman2 = RomanNumeral('random')
        correct_answer = roman1 + roman2
main()
</code></pre>

<p>But when I run it, i get this error:</p>

<pre><code>r_integer += integer_list[index]
UnboundLocalError: local variable 'r_integer' referenced before assignment
</code></pre>

<p>Any suggestions on how to fix this issue? </p>

<p>As well, I need help overloading the <strong>int</strong> method to change the roman numerals to integers so that they can be added together. </p>

<p>You aren't using the integer defined for self. Try adding a declaration after </p>

<pre><code> r_string = r_string.upper()
</code></pre>

<p>Add </p>

<pre><code>r_integer = self.__integer
</code></pre>

<p>That way you have a local copy to work with. </p>

<p>However you do need to overload the integer method which is answered in <a href="http://stackoverflow.com/q/11575393/5721740" title="this post">this post</a></p>

python roman-numerals