Skip to content

Instantly share code, notes, and snippets.

View moqdm's full-sized avatar
๐Ÿ›๏ธ

Mohammad Amin Moghaddam moqdm

๐Ÿ›๏ธ
View GitHub Profile
@moqdm
moqdm / log.sql
Created September 7, 2021 19:27
it's my PSet 7: Fiftyville solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
-- Keep a log of any SQL queries you execute as you solve the mystery.
-- Get descriptions of the crimes that happened in 28-July(7)-2020 in the Chamberlin St.
SELECT description FROM crime_scene_reports WHERE day = "28" AND month = "7" AND year = "2020" AND street = "Chamberlin Street";
-- Check the transcript of the theft date interviews mentioned by the courthouse.
SELECT transcript FROM interviews WHERE day = "28" AND month = "7" AND year = "2020" AND transcript like "%courthouse%";
-- Based on transcript of the first interview: Finding the names of the people who exit the courthouse 10 minutes after the theft.
SELECT name FROM people JOIN courthouse_security_logs ON people.license_plate = courthouse_security_logs.license_plate WHERE day = "28" AND month = "7" AND year = "2020" AND hour = "10" AND minute >= "15" AND minute < "25" AND activity = "exit";
@moqdm
moqdm / movies.sql
Created September 6, 2021 13:35
it's my PSet 7: Movies solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
-- 1.sql
SELECT title FROM movies WHERE year LIKE "2008";
-- 2.sql
SELECT birth FROM people WHERE name LIKE "Emma Stone";
-- 3.sql
SELECT title FROM movies WHERE year>="2018" ORDER BY title;
-- 4.sql
SELECT COUNT(title) FROM movies WHERE id IN (SELECT movie_id FROM ratings WHERE rating LIKE "10.0");
-- 5.sql
SELECT title, year FROM movies WHERE title LIKE "Harry Potter%" ORDER BY year;
@moqdm
moqdm / songs.sql
Created September 6, 2021 13:22
it's my Lab 7: Songs solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
-- 1.sql
SELECT name FROM songs;
-- 2.sql
SELECT name FROM songs ORDER BY tempo;
-- 3.sql
SELECT name FROM songs ORDER BY duration_ms DESC LIMIT 5;
-- 4.sql
SELECT name FROM songs WHERE danceability > 0.75 AND energy > 0.75 AND valence > 0.75;
-- 5.sql
SELECT avg(energy) FROM songs;
@moqdm
moqdm / dna.py
Last active September 6, 2021 13:30
it's my PSet 6: DNA solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
import csv
import sys
import re
if len(sys.argv) != 3:
print("Usage: python dna.py data.csv sequence.txt")
# Read DNA sequence
with open(sys.argv[2], "r") as txt:
dna = txt.read(-1)
@moqdm
moqdm / readability.py
Last active September 6, 2021 13:30
it's my PSet 6: Sentimental / Readability solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
from sys import exit
# Get Text...
text = input("Text: ")
# Variables...
h = 0
s = 0
l = 0
c = 0
@moqdm
moqdm / cash.py
Last active September 6, 2021 13:30
it's my PSet 6: Sentimental / Cash solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
from cs50 import get_float
c = 0
# Get owe...
print("Write down the amount you owe to calculate the number of coins like ($.ยข)... ")
o = 0
while True:
o = get_float("Owed: ")
if o > 0:
break
@moqdm
moqdm / marioM.py
Last active September 6, 2021 13:30
it's my PSet 6: Sentimental / Mario (More) solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
from cs50 import get_int
# Notification
print("Welcome, Please enter a number from one to eight to build.")
# Getting height.
h = 0
while 1 > h or h > 8:
h = get_int("Height: ")
# Build.
for row in range(1, (h + 1), 1):
@moqdm
moqdm / marioL.py
Last active September 6, 2021 13:29
it's my PSet 6: Sentimental / Mario (Less) solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
from cs50 import get_int
# Notification
print("Welcome, Please enter a number from one to eight to build.")
# Getting height.
h = 0
while 1 > h or h > 8:
h = get_int("Height: ")
# Build.
for i in range(h):
@moqdm
moqdm / hello.py
Last active September 6, 2021 13:29
it's my PSet 6: Sentimental / Hello solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
# Asking name
name = input("What's your name? ")
# Say Hello
print(f"Hello, {name}!")
print("I'm Moqi. Nice to meet you.")
@moqdm
moqdm / tournament.py
Created August 30, 2021 15:42
it's my Lab 6: World Cup solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
# Simulate a sports tournament
import csv
import sys
import random
# Number of simluations to run
N = 1000