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
-- Keep a log of any SQL queries you execute as you solve the mystery. | |
-- crime happened on july 28, 2021 and it took place on Humphrey Street | |
-- check the description of the crime in the cime scene reports table at the known day and place | |
select description from crime_scene_reports | |
where year=2021 and month = 7 and day = 28 and street = "Humphrey Street"; | |
-- checking the interview stranscripts |
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
-- In 1.sql, write a SQL query to list the titles of all movies released in 2008 | |
select title from movies where year=2008; | |
-- In 2.sql, write a SQL query to determine the birth year of Emma Stone | |
select birth from people where name="Emma Stone"; | |
-- In 3.sql, write a SQL query to list the titles of all movies with a release date on or after 2018, in alphabetical order. |
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
-- In 1.sql, write a SQL query to list the names of all songs in the database | |
SELECT name FROM songs; | |
-- In 2.sql, write a SQL query to list the names of all songs in increasing order of tempo. | |
SELECT name FROM songs ORDER BY tempo; | |
-- In 3.sql, write a SQL query to list the names of the top 5 longest songs, in descending order of length. | |
SELECT name FROM songs ORDER BY duration_ms DESC LIMIT 5; | |
-- In 4.sql, write a SQL query that lists the names of any songs that have danceability, energy, and valence greater than 0.75. |
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 csv | |
import sys | |
def main(): | |
# TODO: Check for command-line usage | |
if len(sys.argv) != 3: | |
print("Usage: python dna.py data.csv sequence.txt") | |
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
# TODO | |
count_letter = 0 | |
count_word = 1 | |
count_sentence = 0 | |
# getting input from user | |
text = input("Text: ") | |
text_length = len(text) |
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
# TODO | |
import sys | |
def main(): | |
# Get card number from the user | |
credit_card_number = get_credit_card_number() |
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
# TODO | |
from cs50 import get_float | |
# keep track of coins used | |
count = 0 | |
while True: | |
change = get_float("Change owned: ") | |
if change > 0: | |
break | |
# round up to the nearest whole number |
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
# TODO | |
from cs50 import get_int | |
# get input from user until input is correct | |
while True: | |
try: | |
height = get_int("Height: ") | |
if (height >= 1) and (height <= 8): | |
break | |
except: |
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
# TODO | |
# get input from user until input is correct | |
while True: | |
try: | |
height = int(input("Height: ")) | |
if (height >= 1) and (height <= 8): | |
break | |
except: | |
print("", end="") |
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
# Simulate a sports tournament | |
import csv | |
import sys | |
import random | |
# Number of simluations to run | |
N = 1000 | |
NewerOlder