title: how do i get this python function to return a value?
body: <p>I have a file which I'm reading in python(test.txt). Sample file contents are as follows.</p>
  
  <pre><code>cool let's/cool
  hi let's/hi
  somek let's/somek
  </code></pre>
  
  <p>I'm searching for cool and if it exists in this file i'm trying to fetch the value let's/cool</p>
  
  <p>I have tried this</p>
  
  <pre><code>file = open('test.txt')
  my_value='cool'
  
  def test_function(my_value):
      for line in file:
          #fields = line.strip().split()
          if line.find(my_value) != -1:
              ddda=line.rsplit(" ",1)[1]
  
              print(ddda)  ###This is giving my value let's/cool
  
  while true:
      b=test_function(my_value)
      print(b) ##not able to fetch the value of ddda here
  </code></pre>
  
  <p>How do I store the value of ddda in my while loop.
  Is there a better way of doing things without using function?
  I'm not using any external modules.</p>