title: Can anyone help me understand what's broken in the code below?
body: <pre><code>degree = {'name1': 'sam',
            'cert1': 'bachelors',
            'name2': 'Ann',
            'cert2': 'masters',
            'name3':'john',
            'cert3': 'associates',
            'name4': 'oz',
            'cert4': 'phd'
            }
  
  print(degree)
  
  
  def sch_degree(name, d_cert):
      for cert in degree:
          if cert == 'bachelors':
              return (f&quot;{name1} is a four year holder of a {cert1}&quot;)
          else:
              if cert == 'associates':
                  return (f&quot;{name2} is a two year holder of a {cert2}&quot;)
              else:
                  if cert == 'masters':
                      return (f&quot;{name3} is a two year holder of a {cert3}&quot;)
                  else:
                      if cert == 'phd':
                          return (f&quot;{name4} is a four year holder of a {cert4}&quot;)
  
  
  sch_degree(name1, cert1)
  </code></pre>
  <pre><code>Traceback (most recent call last):
  
    File &quot;&lt;ipython-input-238-4c32ecccc897&gt;&quot;, line 1, in &lt;module&gt;
      sch_degree(name1, cert1)
  
  NameError: name 'cert1' is not defined 
  </code></pre>