forked from talkpython/100daysofcode-with-python-course
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpopulateosdb.py
More file actions
26 lines (20 loc) · 697 Bytes
/
populateosdb.py
File metadata and controls
26 lines (20 loc) · 697 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
import sqlite3
is_still_used = 1
is_not_still_used = 0
done = ""
with sqlite3.connect('operatingsystems.db') as connection:
c = connection.cursor()
while done is not "q":
fields = []
name = input("Name: ")
fields.append(name)
platform = input("Platform: ")
fields.append(platform)
stillused = input("Still In Wide Use? (Y/N)")
if stillused == "y":
fields.append(is_still_used)
else:
fields.append(is_not_still_used)
c.execute("""INSERT INTO OperatingSystems VALUES (?,?,?)""", fields)
done = input("Enter q to quit adding rows. Anything else to continue")