title: python re data structure
body: <p><strong>The dataset file in assets/grades.txt contains a line separated list of people with their grade in a class. Create a regex to generate a list of just those students who received a B in the course.</strong></p>
  <pre><code>def grades():
      with open (&quot;assets/grades.txt&quot;, &quot;r&quot;) as file:
          grades = file.read()
          for line in grades:
              line = line.rstrip()
              if re.search('^X\S*: [0-9.]+', line):
              print(line)
      
           
  
  assert len(grades()) == 16
  </code></pre>
  <p>The easy solution is to add the following regular expression '([A-Z][a-z]+ [A-Z][a-z]+): B'.
  this solution is provided from <a href="https://stackoverflow.com/users/13425935/abd-elrhman-mohey">abd-elrhman-mohey</a></p>