Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import sqlite3
  2.  
  3. connection = sqlite3.connect("people")
  4. cur = connection.cursor()
  5.  
  6. while True:
  7.     first_name = input("Please enter first name:")
  8.     if len(first_name) < 1: break
  9.     last_name = input("Please enter last name:")
  10.     age = input("Please insert age")
  11.     try:
  12.         age = int(age)
  13.     except:
  14.         break
  15.  
  16.     occupation = input("Please inster occupation:")
  17.  
  18.     cur.execute("INSERT INTO people (first_name, last_name, age, occupation) VALUES ('%s', '%s', %d, '%s')" % (first_name, last_name, age, occupation))
  19.     print(age)
  20.  
  21. connection.commit()
  22. connection.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement