Midterm 1 - Take Home

Due: Sunday, February 25 at 11:59 pm

Submission: On Courseworks

Instructions

Please read the instructions carefully. An incorrectly formatted submission may not be counted.

This midterm consists of short answer, pseudocode, and Python programming questions. To submit, copy and paste the rest of this webpage into a document called uni-midterm.txt (so for me this would be tkp2108-midterm.txt). Submit this file on courseworks. For the Python programming questions, you may use any editor or IDE you choose, such as Jupyter or Spyder, but copy and paste your functions into the templates provided and submit inline in the txt file.





####### Q1 - Short Answer #######

What is scope? How does scope work in python? If I create a variable outside a function and inside a function, what happens?





####### Q2 - Pseudocode #######

Write pseudocode for the following problem:

Given an input list of integers lst, return True if the list is in increasing order, otherwise return False.





####### Q3 - Python #######

Write Python code for the following problem:

Given an input list called input_list, return a new list that only contains the elements that appeared once.

For example, given an input list [1, 1, 2, 3, 3, 4, 5, 5] the return values would be [2, 4]. Your code should work properly for an empty list, lists with no duplicates, lists with only duplicates, etc.

def unique_elements(input_list):
    # your code here