-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunctions.py
More file actions
76 lines (64 loc) · 2.28 KB
/
Copy pathfunctions.py
File metadata and controls
76 lines (64 loc) · 2.28 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
import sqlite3
import random
def yearfordriver():
con = sqlite3.connect("F1.db")
cur = con.cursor()
randyeard = random.randrange(72) + 1
cur.execute("SELECT year from years WHERE idYears = ?", (randyeard,))
year = cur.fetchone()
yeartbddriver = str(year[0])
cur.close()
return yeartbddriver, randyeard
def whodriver(x):
con = sqlite3.connect("F1.db")
cur = con.cursor()
cur.execute("SELECT driver_champion from years WHERE idYears = ?", (x,))
id = cur.fetchone()
cur.execute("SELECT name from drivers WHERE idDriver = ?", (id))
right_anwser = cur.fetchone()
driver = str(right_anwser[0])
cur.close()
return driver
def driverio(k):
con = sqlite3.connect("F1.db")
cur = con.cursor()
cur.execute("SELECT year from years WHERE idYears = ?", (k,))
yearx = cur.fetchone()
cur.execute("SELECT driver_champion from years WHERE idYears = ?", (k,))
id = cur.fetchone()
cur.execute("SELECT name FROM drivers WHERE idDriver =?", (id))
right_anwser = cur.fetchone()
driver = str(right_anwser[0])
year = str(yearx[0])
return driver, year
def yearforconstructor():
con = sqlite3.connect("F1.db")
cur = con.cursor()
randyearc = random.randrange(64) + 1
cur.execute("SELECT year from years WHERE idYears = ?", (randyearc,))
year = cur.fetchone()
yeartbdcons = str(year[0])
cur.close()
return yeartbdcons, randyearc
def whoconstructor(x):
con = sqlite3.connect("F1.db")
cur = con.cursor()
cur.execute("SELECT constructor_champion from years WHERE idYears = ?", (x,))
id = cur.fetchone()
cur.execute("SELECT name_cons FROM constructors WHERE idConstructors =?", (id))
right_anwser = cur.fetchone()
constructor = str(right_anwser[0])
cur.close()
return constructor
def constructorio(k):
con = sqlite3.connect("F1.db")
cur = con.cursor()
cur.execute("SELECT year from years WHERE idYears = ?", (k,))
yearx = cur.fetchone()
cur.execute("SELECT constructor_champion from years WHERE idYears = ?", (k,))
id = cur.fetchone()
cur.execute("SELECT name_cons FROM constructors WHERE idConstructors =?", (id))
right_anwser = cur.fetchone()
constructor = str(right_anwser[0])
year = str(yearx[0])
return constructor, year