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
DB: https://lagunita.stanford.edu/c4x/DB/SQL/asset/moviedata.html | |
For all cases where the same reviewer rated the same movie twice and gave it a higher rating the second time, return the reviewer's name and the title of the movie. | |
SELECT name, title | |
FROM movie, reviewer, | |
(SELECT rating1.rID, rating1.mID | |
FROM rating rating1, rating rating2 | |
WHERE rating1.rID = rating2.rID | |
AND rating1.mID = rating2.mID |
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
# Year -- the year the data in the row is for. | |
# WHO Region -- the region in which the country is located. | |
# Country -- the country the data is for. | |
# Beverage Types -- the type of beverage the data is for. | |
# Display Value -- the number of liters, on average, of the beverage type a citizen of the country drank in the given year. | |
# Use the csv module to read world_alcohol.csv into the variable world_alcohol. | |
# You can use the csv.reader method to accomplish this. | |
# world_alcohol should be a list of lists. | |
# Extract the first column of world_alcohol, and assign it to the variable years. |
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
sample = ['GTA','GGG','CAC'] | |
def read_dna(dna_file): | |
dna_data = '' | |
with open(dna_file, 'r') as f: | |
for line in f: | |
dna_data += line | |
return dna_data | |
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
function multiplyByThree(array) { | |
var multiplier = 3; | |
// Handle undefined or null inputs | |
if (!array) { | |
throw new Error("Argument is undefined or null"); | |
} | |
// Handle non-array inputs | |
if (!Array.isArray(array)) { |
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
server { | |
listen 80; | |
server_name localhost; # Change this with your domain name | |
root /usr/share/nginx/html; # The place were you have setup your Grav install; | |
index index.php; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root html; |
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
def find_next_prime(n): | |
n+=1 | |
for i in range(2, n): | |
if n%i == 0: | |
n += 1 | |
else: | |
print n | |
pass | |
find_next_prime(6) |
NewerOlder