-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
39 lines (30 loc) · 972 Bytes
/
main.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
import os
import json
import matplotlib.pyplot as plt
import matplotlib.image as i
def show_figure(f):
img = i.imread(f)
plt.imshow(img)
plt.show()
def main():
# load course data
with open('course.json', 'r') as f:
course = json.load(f)
# run through course lessons
for lesson in course:
for question in lesson['questions']:
with open(question['file'], 'r') as f:
os.system('clear')
for line in f.readlines():
print(line.strip())
if question['type'] == 'message':
print()
input('Druk op de enter toets om verder te gaan...')
elif question['type'] == 'figure':
print()
input('Druk op de enter toets om verder te gaan')
show_figure(question['figure'])
else:
pass
if __name__ == '__main__':
main()