forked from afropolymath/bootcamp-git-practice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample.py
49 lines (41 loc) · 969 Bytes
/
sample.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#Lodash for python
def unique(l):
'''
This function generate a list of unique values from l
'''
pass
def reverse(s):
'''
This function generates the reverse of s. s can be a string or a list. It returns the type given to it
'''
pass
def intersection(a,b):
'''
This function returns the intersection of a and b - A list of common elements between a and b
'''
intersect = []
for list1 in a:
for list2 in b:
if(list1 == list2):
intersect.append(list1)
return intersect
def generate(steps):
pass
def parse_csv(csv_string):
'''
This function parses a CSV string as a list. The specification demands that the first row of data represents the column names
'''
pass
def frequency(needle, haystack):
'''
This function returns the number of times needle appears in haystack
'''
pass
def sort(l):
'''
This function returns a sorted version of l
'''
for i in range(len(l)-1):
if l[i] > l[i+1]:
l[i+1], l[i] = l[i], l[i+1]
return l