Selecting part of a string for calculations (python)
<p>I'm working on a for-fun-project that I will be doing some calculations with and I need some help. </p>

<p>one module from my program:</p>

<pre><code>def ARK(rawArk):
    refArk = rawArk/200
    arkTrit = refArk*300
    arkMeg = refArk*333
    arkZyd = refArk*166
    print "Totals from your Arkonor:"
    print "Tritanium=", arkTrit
    print "Megacyte=", arkMeg
    print "Zydrine=", arkZyd
    return arkTrit, arkMeg, arkZyd
</code></pre>

<p>Right now it is just doing simple division and multiplication. What I want to do is be able to do this with remainders.</p>

<p>So if 'refArk = rawArk/200' gives a total of 16.3, I want to be able to separate the 16.0 and the 0.3 and use them as separate variables for separate calculations.</p>

<p>So far:</p>

<pre><code>def ARK(rawArk):
    refArk = float(rawArk/200)
    arkTrit = refArk*300
    arkMeg = refArk*333
    arkZyd = refArk*166
    print "Totals from your Arkonor:"
    print "Tritanium=", arkTrit
    print "Megacyte=", arkMeg
    print "Zydrine=", arkZyd
    strval = str(refArk)
    head,tail = strval.split(".")
    whole = float(head)
    frac = float("."+tail)
    print whole
    print frac
    return arkTrit, arkMeg, arkZyd

def main():
    rawArk=input("How much Arkonor?")
    ARK(rawArk)
    return

main()
</code></pre>

<p>USING '450' as my input value</p>

<p>returns</p>

<pre><code>How much Arkonor?450
Totals from your Arkonor:
Tritanium= 600.0
Megacyte= 666.0
Zydrine= 332.0
2.0
0.0
</code></pre>

<p>The 2.0 is right but the 0.0 should be 0.25</p>

<p>Removing the float() from the 'rawArk/200' spits out an error:</p>

<pre><code>How much Arkonor?450
Totals from your Arkonor:
Tritanium= 600
Megacyte= 666
Zydrine= 332

Traceback (most recent call last):
  File "E:\eve stuff\Calculator\test.py", line 23, in &lt;module&gt;
    main()
  File "E:\eve stuff\Calculator\test.py", line 20, in main
    ARK(rawArk)
  File "E:\eve stuff\Calculator\test.py", line 11, in ARK
    head,tail = strval.split(".")
ValueError: need more than 1 value to unpack
</code></pre>
