-
Notifications
You must be signed in to change notification settings - Fork 0
/
Prac2.py
executable file
·38 lines (32 loc) · 838 Bytes
/
Prac2.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
#!/usr/bin/python3.
"""
Python Practical 2 Code for heterodyning and performance testing
Keegan Crankshaw
EEE3096S Prac 2 2019
Date: 7 June 2019
This isn't exactly performant code, but it is Pythonic
This is done to stress the differences between Python and C/C++
"""
# import Relevant Librares
import Timing
from data import carrier, data
# Define values.
c = carrier *30
d = data *30
result = []
# Main function
def main():
print("using type {}".format(type(data[0])))
Timing.startlog()
for i in range(len(c)):
result.append(c[i] * d[i])
Timing.endlog()
print(result[0:10])
# Only run the functions if this module is run
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("Exiting gracefully")
except Exception as e:
print("Error: {}".format(e))