Format: text/x-python
⬇ Download File (437 B)
   1  # -*- coding: utf-8 -*-
   2  """
   3  Created on Fri May 21 21:50:54 2021
   4  
   5  @author: PC
   6  """
   7  
   8  import re
   9  
  10  import os
  11  os.chdir(r'C:\Users\PC\Pytho')
  12  def grades():
  13      with open ("grades.txt", "r") as file:
  14          grades = file.read()
  15  
  16      students= re.findall('([A-Z][a-z]+ [A-Z][a-z]+): B',grades)
  17      #raise NotImplementedError()
  18      return students
  19      
  20  print(grades())
  21  print(len(grades()))    
  22      
  23  assert len(grades()) == 16