home |
copyright ©2016, tim@menzies.us
overview |
syllabus |
src |
submit |
chat
- What does a python function return by default?
- How do you access global variables in python?
- What is a decorator?
- What does a seed do in a random number generator?
- What happens if an assertion is false?
- Give a use case for lt
- What does str do
##Practice
- 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
- 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]
- Give a snippet highlighting inheritance in python