Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.42 KB

review1.md

File metadata and controls

49 lines (39 loc) · 1.42 KB

home | copyright ©2016, tim@menzies.us

overview | syllabus | src | submit | chat


Review-1

Lecture Date : 08/23/2016 & 08/25/2016

Theory


  1. What does a python function return by default?
  2. How do you access global variables in python?
  3. What is a decorator?
  4. What does a seed do in a random number generator?
  5. What happens if an assertion is false?
  6. Give a use case for lt
  7. What does str do

##Practice


  1. For each of the following, can you offer a 3 line code snippet to demo the idea?
  • Classes
  • Functions
  • default params
  • variable lists args
  • variable dictionary args
  • decorators
  • exception handling
  1. Write a function that takes 2 args(Arg1 and Arg2) such that Arg 1 is a list of numbers, Arg2 is a number. Return a list of size Arg2 from Arg1 such that no duplicates are present. eg
def func(arg1, arg2):
  do something
  
x = func([1,2,3,4,5,6,7,8], 4)
# x is [6,2,7,1]
  1. Give a snippet highlighting inheritance in python