-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
25 lines (15 loc) · 690 Bytes
/
main.py
File metadata and controls
25 lines (15 loc) · 690 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
#!/usr/bin/env python3
from newsdb import first_query, second_query, third_query
def main():
print('\nGrabbing info from database...\n')
print('Most Popular Three Articles:-\n')
for title, count in first_query():
print(str(title) + " - " + str(count) + " views")
print('\nMost Popular Article Authors of All Time:-\n')
for title, count in second_query():
print(str(title) + " - " + str(count) + " views")
print('\nErrors of more than 1 percent:-\n')
for title, count in third_query():
print("{} - {:.2f}% errors".format(str(title), round((float(count) * 100), 2)))
if __name__ == '__main__':
main()