-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRunFree.py
More file actions
161 lines (134 loc) · 5.37 KB
/
RunFree.py
File metadata and controls
161 lines (134 loc) · 5.37 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
import sqlite3
import time
con = sqlite3.connect("personal_project1.db")
cur = con.cursor()
import time
def seconds(n):
return time.sleep(n)
print("Welcome to RunFree!\n")
seconds(3)
print("I'll help you find the right training program for ya...\n")
seconds(3)
cur.execute('''
CREATE TABLE IF NOT EXISTS user (
user_id INTEGER PRIMARY KEY,
username TEXT,
password TEXT)
'''
)
con.commit()
i=1
# LOGIN SCREEN------------------------------------------------------------------------------------------------------------------------------------
login_1=str(input("Let's get started! If you already have an account, type \"Y\". Otherwise, type \"N\" to get started\n"))
reset = "N/A"
# While loop to keep trying if user gets something wrong in the login
while i > 0:
if login_1 == "Y" or reset == "Y":
login_1="N/A"
# Another while loop to keep trying if username is incorrect
while True:
login_2U = input("Username: ")
login_2P = input("Password: ")
print("")
# Getting user input and extracting it from "user" database (U and P)
cur.execute("SELECT username FROM user WHERE username=?", (login_2U,))
con.commit()
username=cur.fetchone()
cur.execute("SELECT password FROM user WHERE password=?", (login_2P,))
con.commit()
user_pw=cur.fetchone()
seconds(3)
# If login is correct, BAAAAANG
if username is not None and user_pw is not None:
print(f"Welcome to RunFree, {login_2U}!\n")
seconds(3)
break
elif username is None:
print("Username not found. Try again")
seconds(1)
elif user_pw is None:
print("Incorrect password. Try again")
seconds(1)
i -= 1
# Adding new user info to the "user" database
elif login_1 == "N":
print("Create account\n")
login_1U = input("Username: ")
login_1P = input("Password: ")
# Inserting new account input into "user" database
# Added except if account already exists
try:
cur.execute('''
INSERT INTO user (username) VALUES (?)
''', (login_1U,))
cur.execute('''
INSERT INTO user (password) VALUES (?)
''', (login_1P,))
con.commit()
print("Successful login")
seconds(3)
# Back to beggining...
reset = str(input("Type \"Y\" to go back to the log in.\n"))
except sqlite3.IntegrityError:
print("Account already exists")
seconds(3)
# Back to beggining...
reset = str(input("Type \"Y\" to go back to the log in.\n"))
# LOGIN SCREEN-----------------------------------------------------------------------------------------------------------------------------------------
# IF USER HAS NO RUNNING PLAN--------------------------------------------------------------------------------------------------------------------------
if True: #if login_1U: #doesnt have table:
seconds(3)
print("It seems you're new here! Let me introduce you to RunFree... \n")
seconds(3)
print("blah blah blah\n")
seconds(3)
print("Ready to get started?\n")
seconds(3)
while True:
continue_no_plan1=input("Type \"Y\" to begin building the right plan for YOU!\n")
if continue_no_plan1=="Y":
break
else:
print("make sure you type capital \"Y\" to get started!!!")
# Gathering info on USERRRR
print(f"Great! Let's gather some personal info so we can make the perfect plan tailored for you, {login_2U}.\n")
seconds(3)
# AGE
age=int(input("How old are you?\n"))
seconds(3)
# GENDER (Male, Female, Other)
while True:
print("What's your gender?\n")
seconds(2)
gender=input("Type \"Male\", \"Female\", or\"Other\"\n")
seconds(3)
if gender=="Male" or gender=="Female" or gender=="Other":
seconds(3)
break
else:
print("Make sure you type the word exactly as it shows!!!")
seconds(3)
# RUNNING EXPERTISE (Begginer, Intermediate, Advanced)
while True:
print("How experienced are you?")
seconds(3)
r_s=input("\"Beginner\", \"Intermediate\", or \"Advanced\"\nPs. Don't know? Type \"I\" to figure out what you should pick!\n")
seconds(3)
if r_s=="I":
print("Blah")
seconds(3)
print("Now that you know...")
seconds(3)
elif r_s=="Beginner" or r_s=="Intermediate" or r_s=="Advanced":
seconds(3)
break
else:
print("Make sure you type the word exactly as it shows!!!")
cur.execute('''
SELECT * WHERE
'''
)
# IF USER HAS NO RUNNING PLAN----------------------------------------------------------------------------------------------------------------------------
# IF USER HAS RUNNING PLAN-------------------------------------------------------------------------------------------------------------------------------
# IF USER HAS RUNNING PLAN-------------------------------------------------------------------------------------------------------------------------------
con.close()