title: Can't figure out what lambda function does in my tkinter project
body: <p>I've written a simple calculator code in <strong>Python</strong> using <strong>Tkinter</strong>. Almost every function works but I can't seem to figure out what the lambda function does in my project. If I add it works without any bug but if I remove it shows an error.</p>
  <h2>Here is the block where the error points out</h2>
  <pre><code>class Calc:
      def __init__(self):
          self.total = 0
          self.current = ''
          self.ip_val = True
          self.check_sum = False
          self.op = ''
          self.result = False
  
      def operation(self, op):
          self.current = float(self.current) #this line generates error
          if self.check_sum:
              self.valid_function()
          elif not self.result:
              self.total = self.current
              self.ip_val = True
          self.check_sum = True
          self.op = op
          self.result = False
  
  </code></pre>
  <h2>Here's the line calling the <strong>CALC</strong> class's operation method.</h2>
  <pre><code>Button(calc, text='x^y', width=6, height=2, font=('arial', 20, 'bold'), bd=4, bg=&quot;gray20&quot;,
         command= res.operation('pow')).grid(row=1, column=5, pady=1)
  
  </code></pre>
  <h2>ERROR MESSAGE</h2>
  <pre><code>Traceback (most recent call last):
    File &quot;T:/WorkSpace/PythonCourse/Day-6.py&quot;, line 235, in &lt;module&gt;
      command= res.operation('pow')).grid(row=1, column=5, pady=1)
    File &quot;T:/WorkSpace/PythonCourse/Day-6.py&quot;, line 69, in operation
      self.current = float(self.current)
  ValueError: could not convert string to float: ''
  </code></pre>
  <p>FYI, I know IF I initialize the Button class like below ( with <strong>lambda</strong> function )</p>
  <pre><code>Button(calc, text='x^y', width=6, height=2, font=('arial', 20, 'bold'), bd=4, bg=&quot;gray20&quot;,
         command= lambda: res.operation('pow')).grid(row=1, column=5, pady=1)
  </code></pre>
  <p>IT WORKS JUST FINE.</p>
  <h2>QUERY</h2>
  <p>I want an explanation of how this lambda function is the solution to this error. And also if the user doesn't press the button, the function shouldn't call itself. How's this even compiling?</p>