This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#1. How many copies of the book titled The Lost Tribe are owned by the library branch whose name is "Sharpstown"? | |
USE SQLAssignment | |
GO | |
SELECT Title, No_Of_Copies, BranchName | |
FROM [BOOK_COPIES] AS BC | |
INNER JOIN [LIBRARY_BRANCH] AS LB ON BC.BranchId = LB.BranchId | |
INNER JOIN [BOOK] AS BK ON BC.BookId = BK.BookID | |
WHERE Title = 'The Lost Tribe' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import urllib2 | |
webpage = urllib2.urlopen("http://inadaybooks.com/justiceleague") | |
# converts "urlopen" object into BeautifulSoup | |
soup = BeautifulSoup(webpage, "html.parser") | |
# finds the first instance of a div that has the id "container" | |
divContainer = soup.find("div", {"id":"container"}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
conn = sqlite3.connect('simpsons.db') | |
# create table named SIMPSON_INFO | |
conn.execute("CREATE TABLE SIMPSON_INFO( ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, GENDER TEXT, AGE INT, OCCUPATION TEXT );") | |
conn.execute("INSERT INTO SIMPSON_INFO (NAME, GENDER, AGE, OCCUPATION) VALUES ('Bart Simpson', 'Male', 10, 'Student')"); | |
conn.execute("INSERT INTO SIMPSON_INFO (NAME, GENDER, AGE, OCCUPATION) VALUES ('Homer Simpson', 'Male', 40, 'Nuclear Plant')"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlite3 | |
conn = sqlite3.connect('simpsons.db') | |
def createTable(): | |
conn.execute("CREATE TABLE if not exists SIMPSON_INFO( \ | |
ID INTEGER PRIMARY KEY AUTOINCREMENT, \ | |
NAME TEXT, \ | |
GENDER TEXT, \ | |
AGE INT, \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
class Frame(wx.Frame): | |
def __init__(self, title): | |
wx.Frame.__init__(self, None,\ | |
title=title, size=(300,250)) | |
panel = wx.Panel(self) | |
button = wx.Button(panel,label="Exit",size=(100,40),pos=(100,100)) | |
# Bind button event to the function self.exit | |
button.Bind(wx.EVT_BUTTON, self.exit) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx, db_program | |
class Frame(wx.Frame): | |
def __init__(self, title): | |
wx.Frame.__init__(self, None,\ | |
title=title, size=(800,600)) | |
panel = wx.Panel(self) | |
# Creating the menu bar | |
menuBar = wx.MenuBar() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print("Let's see how long you have lived in days, minutes and seconds.") | |
name = input("name: ") | |
print("now enter your age") | |
age = int(input("age: ")) | |
days = age * 365 | |
minutes = age * 525948 | |
seconds = age * 31556926 | |
print(name, "has been alive for", days,"days", minutes, "minutes and", seconds, "seconds! Wow!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
global gold | |
global apples | |
apples = 0 | |
gold = 0 | |
def start(): | |
print ("Hello and welcome!") | |
name = raw_input("What's your name:") | |
print ("Welcome, "+name+"!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
class Frame(wx.Frame): | |
def __init__(self, title): | |
wx.Frame.__init__(self, None, title=title, size=(300,250)) | |
panel = wx.Panel(self) | |
menuBar = wx.MenuBar() | |
fileButton = wx.Menu() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wx | |
class Frame(wx.Frame): | |
def __init__(self, title): | |
wx.Frame.__init__(self, None, title=title, size=(300,250)) | |
panel = wx.Panel(self) | |
menuBar = wx.MenuBar() | |
fileButton = wx.Menu() |