Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

i am questioning like everything I can't figure out why it is giving me a syntax error

,,,

students = [['Kermit Wade', 27] ,['Hattie Schleusner', 67], ['Ben Ball', 5] ,['William Lee', 2]]

def Select(students, threshold):
 def Convert(lst):
  res = dict()
  for sub in lst:
   res[tuple(sub[:1])] = tuple(sub[1:])
  return res
  def get_key(val):
    for key, value in Convert(students).items():
         if (val,) == value:
             return key
 s=Convert(students)
 def get_key(val):
    for key, value in Convert(students).items():
         if (val,) == value:
             return key
 e=[]
 
 
 for k in range(threshold,100):
  if get_key(k) != None:

   e.append(get_key(k))
   e.append(s.get(get_key(k)))
 z=e
 new_lst= str(set(z)-set(',() {},  ')





Select(students, 50)

,,,

What is wrong with this code My computer is telling me the error is on 550 where it says select(students,50) But I can’t find the problem

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If you look at line: 30 you can see there is a missing parentheses. Replace new_lst = str(set(z) - set(',() {}, ') with new_lst = str(set(z) - set(',() {}, ')).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading