;

Sample Dictionary Question

Sample question only. The task is similar to what will be evaluated during the exam.

Task

Imagine you have a dictionary such as student_scores below where each key is a student and the value is their score on a test.

student_scores = {‘Zack’: 93, ‘Anne’: 87, ‘Kyle’: 98, ‘Pam’: 45}

Complete the function sorted_students so that it returns a list of each student who has scored at least a 75. Sort the list by the student scores descending.

Function Start

def sorted_students ( student_scores ):

   #TO DO

   pass

Function Output

The sorted list of students

[ ‘Kyle’ , ‘Zack’ , ‘Anne’ ]

    Sample String Question

    Sample question only. The task is similar to what will be evaluated during the exam.

    Task

    Imagine you have a string that represents an individual’s email address.

    email = ‘[email protected]

    Complete the function email_domain so that it returns the email address domain (everything after the @ symbol). In the example above, it should return ‘gmail.com’.

    Function Start

    def email_domain ( email ):

       #TO DO

       pass

    Function Output

    The email domain of the email address

    gmail.com

      Sample Pandas Question

      Sample question only. The task is similar to what will be evaluated during the exam.

      Task

      Imagine you have a dataframe such as the table below

      a b c
      150 ‘Google’ 6.6
      200 ‘Facebook’ 8.0
      75 ‘Google’ -4.5

      Complete the function df_filtering so that it returns a dataframe that only keeps rows where column b is equal to ‘Facebook’ or column a is at least 100.

      Function Start

      def df_filtering ( df ):

         #TO DO

         pass

      Function Output

      The filtered dataframe

       

      a b c
      150 ‘Google’ 6.6
      200 ‘Facebook’ 8.0

        Ready to get started evaluating your applicants’ skills?