title: ValueError: invalid literal for int () with base 10
body: <p>I wrote a program to solve <code>y = a^x</code> and then project it on a graph. The problem is that whenever <code>a &lt; 1</code> I get the error: </p>
  
  <blockquote>
    <p>ValueError: invalid literal for int () with base 10.</p>
  </blockquote>
  
  <p>Any suggestions? </p>
  
  <p>Here's the traceback:</p>
  
  <pre><code>Traceback (most recent call last): 
     File "C:\Users\kasutaja\Desktop\EksponentfunktsioonTEST - koopia.py", line 13, in &lt;module&gt; 
     if int(a) &lt; 0: 
  ValueError: invalid literal for int() with base 10: '0.3' 
  </code></pre>
  
  <p>The problem arises every time I put a number that is smaller than one, but larger than 0. For this example it was 0.3 .</p>
  
  <p>This is my code:</p>
  
  <pre><code>#  y = a^x
  
  import time
  import math
  import sys
  import os
  import subprocess
  import matplotlib.pyplot as plt
  print ("y = a^x")
  print ("")
  a = input ("Enter 'a' ")
  print ("")
  if int(a) &lt; 0:
      print ("'a' is negative, no solution")
  elif int(a) == 1:
      print ("'a' is equal with 1, no solution")
  else:
      fig = plt.figure ()
      x = [-2,-1.75,-1.5,-1.25,-1,-0.75,-0.5,-0.25,0,0.25,0.5,0.75,1,1.25,1.5,1.75,2]
      y = [int(a)**(-2),int(a)**(-1.75),int(a)**(-1.5),int(a)**(-1.25),
              int(a)**(-1),int(a)**(-0.75),int(a)**(-0.5),int(a)**(-0.25),
              int(a)**(0),int(a)**(0.25),int(a)**(0.5),int(a)**(0.75),
              int(a)**1,int(a)**(1.25),int(a)**(1.5),int(a)**(1.75), int(a)**(2)]
  
  
      ax = fig.add_subplot(1,1,1)
      ax.set_title('y = a**x')
      ax.plot(x,y)
      ax.spines['left'].set_position('zero')
      ax.spines['right'].set_color('none')
      ax.spines['bottom'].set_position('zero')
      ax.spines['top'].set_color('none')
      ax.spines['left'].set_smart_bounds(True)
      ax.spines['bottom'].set_smart_bounds(True)
      ax.xaxis.set_ticks_position('bottom')
      ax.yaxis.set_ticks_position('left')
  
  
      plt.savefig("graph.png")
      subprocess.Popen('explorer "C:\\Users\\kasutaja\\desktop\\graph.png"')
  
  def restart_program(): 
      python = sys.executable
      os.execl(python, python, * sys.argv)
  
  if __name__ == "__main__":
      answer = input("Restart program? ")
      if answer.strip() in "YES yes Yes y Y".split():
          restart_program()
      else:
          os.remove("C:\\Users\\kasutaja\\desktop\\graph.png")
  </code></pre>