Raspberry Pi - Data Logging and Databases
Given this Python code on Raspberry Pi:
What will be printed?
import sqlite3
conn = sqlite3.connect('data.db')
cursor = conn.cursor()
cursor.execute('CREATE TABLE IF NOT EXISTS readings (id INTEGER PRIMARY KEY, value REAL)')
cursor.execute('INSERT INTO readings (value) VALUES (23.5)')
conn.commit()
cursor.execute('SELECT value FROM readings WHERE id=1')
print(cursor.fetchone()[0])
conn.close()What will be printed?
