-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathexercise.py
More file actions
55 lines (39 loc) · 992 Bytes
/
exercise.py
File metadata and controls
55 lines (39 loc) · 992 Bytes
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
50
51
52
53
54
55
'''
An exercise to practice collaboration using git and Github.
Author: Bosco Noronha (nbosco)
Date: 25th Oct 2015
'''
'''
Purpose of the function:
Given a array of integers, return the length of the array.
Eg. Input: [1, 2, 3, 4, 5, 6, 7, 8]
Output: 8
'''
def amountInArray(array):
'''
Purpose of the function:
Given a array of integers, return the sum of all the integers.
Eg. Input: [1, 2, 3, 4, 5, 6, 7, 8]
Output:
'''
def sumOfArray(array):
'''
Purpose of the function:
Given a array of integers, return the array in reverse order.
Eg. Input: [1, 2, 3, 4, 5, 6, 7, 8]
Output:[8, 7, 6, 5, 4, 3, 2, 1]
'''
def reverseArray(array):
'''
Purpose of the function:
Given a array of integers, return the array shuffled.
Eg. Input: [1, 2, 3, 4, 5, 6, 7, 8]
Output:[8, 2, 1, 5, 7, 3, 4, 6]
'''
def shuffleArray(array):
#MAIN
array = [1, 2, 3, 4, 5, 6, 7, 8]
print amountInArray(array)
print sumOfArray(array)
print reverseArray(array)
print shuffleArray(array)