title: How to add float?
body: <p>So, i tried to make a simple calc and i wanted to make sure user wont be able to input values that will cause an error. Now, i dont know why but it gives me error: </p>
  
  <pre><code>Traceback (most recent call last):
    File "ct.py", line 50, in &lt;module&gt;
      p = a + b
  TypeError: can only concatenate str (not "float") to str
  </code></pre>
  
  <p>Tried with except ValueError instead of making if and throwing every argument, and it worked, but code is messy so i tried to clean it up a little bit/ do it other, simplier way. </p>
  
  <pre><code>import time
  def ll(a):
      return all(x in "0123456789.+-" for x in a)
  def countdot(text):
      count = 0
      for c in text:
          if c == '.':
              count = count + 1
      return count
  def countminus(text):
      count = 0
      for c in text:
          if c == '-':
              count = count + 1
      return count
  def a1():
      a = input("Wprowadz pierwszą liczbę: ")
      err = True
      while err == False:
          if ll(a)== True and a != "." and a != "-" and a != "+" and countdot(a) &lt;= 1 and countminus(a) &lt;= 1:
              a = float(a)
              err = True
          else:
              print("To nie liczba!")
              b = input("Wprowadz pierwszą liczbę: ")
      return a
  def b1():
      err = True
      b = input("Wprowadz drugą liczbę: ")
      while err == True:
          if ll(b)== True and b != "." and b != "-" and b != "+" and countdot(b) &lt;= 1 and countminus(b) &lt;= 1:
              b = float(b)
              err = False
          else:
              print("To nie liczba!")
              b = input("Wprowadz drugą liczbę: ")
      return b
  repeat = True   
  while repeat == True:
      print("Prosty Kalukator. Wybierz działanie: ")
      print("Dodawanie: +, Odejmowanie: -, Mnożenie: *, Dzielenie: /")
      d = input()
      while d != "+" and d != "-" and d != "*" and d != "/" :
          print("Błąd! Dodawanie: +, Odejmowanie: -, Mnożenie: *, Dzielenie: /")
          d = input()
      if d == "+" :
          a = a1()
          b = b1()
          print("Wynik działania to: ")
          p = a + b
          p = float(p)
          print(p)
  </code></pre>
  
  <p>I expected it to just add a and b "p = a + b" and it just gives me error.</p>