-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpredict.py
44 lines (40 loc) · 967 Bytes
/
predict.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
import sqlite3
def main():
conn = sqlite3.connect('test.db')
rt1=0
rt=0
b=0
a=0
b=0
ft=[]
cursor = conn.execute("SELECT TID,Totrating FROM GEN")
for row in cursor:
wk=row[0]
rt=row[1]
# print("Wk=%d and rt=%2f"%(wk,rt))
if wk==1:
rt1=rt
else:
ft.append(rt-rt1)
rt1=rt
f = open("predict.txt","w")
for row in ft:
# print("ft=%2f"%row)
b+=row
if b>1 or rt1>5:
# print("\nSuccess=%2f"%b)
print("\nThe product will be a success in the future")
f.write("The product will be a success in the future")
elif b<1 or rt1<5:
# print("\nFailure=%2f"%b)
print("\nThe product will be a failure in the future")
f.write("The product will be a failure in the future")
else:
# print("\nNeutral=%2f"%b)
print("\nThe product will be a neutral in the future")
f.write("The product will be a neutral in the future")
conn.commit()
conn.close()
f.close()
if __name__ == "__main__":
main()