REALLY simple functions with tuples (python)
<p>I know this is really easy but I can't understand how to code at all. So I need to create two functions (if you can only help me with one that's fine):</p>

<p>Function a which receives a positive integer and transforms it into a tuple, like this:</p>

<pre><code>&gt;&gt;&gt;a(34500)
(3, 4, 5, 0, 0)
&gt;&gt;&gt;a(3.5)
ValueError: a: error
</code></pre>

<p>And function b which receives a tuple and transforms it into an integer, like this:</p>

<pre><code>&gt;&gt;&gt;b((3, 4, 0, 0, 4))
34004
&gt;&gt;&gt;b((2, âaâ, 5))
ValueError: b: error
</code></pre>

<p>I haven't learned much yet, only functions, while and for cycles, tuples, raise and isinstance(for the error message?), and probably some other things. I've tried looking for answers but they all used things I haven't learned.</p>

<p>The comments already state what you can do:
Convert the int to str by doing (I know this does not work for floats, here you can show some further effort:)) </p>

<pre><code>for c in str(integerVariable):
    print c
</code></pre>

<p>The other way around is even more simple.</p>

<pre><code>''.join(tupleVariable)
</code></pre>

python function tuples