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
SELECT * | |
FROM startups; | |
SELECT COUNT(name) | |
FROM startups; | |
SELECT SUM(valuation) | |
FROM startups; | |
SELECT MAX(raised) |
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 ground_shipping(weight): | |
if weight > 10.0: | |
return weight * 4.75 + 20.0 | |
elif weight > 6.0 and weight <= 10.0: | |
return weight * 4.00 + 20.0 | |
elif weight > 2.0 and weight <= 6.0: | |
return weight * 3.00 + 20.0 | |
else: | |
return weight * 1.50 + 20.0 |
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
train_mass = 22680 | |
train_acceleration = 10 | |
train_distance = 100 | |
bomb_mass = 1 | |
def f_to_c(f_temp): | |
c_temp = (f_temp - 32) * 5/9 | |
return c_temp | |
f100_in_celsius = f_to_c(100) |
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
// Define the initial value of kelvin and | |
// set to 293 degrees kelvin | |
const kelvin = 293; | |
// convert degrees kelvin to degrees celcius by subtracting 273 | |
const celsius = kelvin - 273; | |
// Convert to degrees fahrenheit and round down | |
let fahrenheit = Math.floor(celsius * (9/5) + 32); | |
console.log(`The temperature ${kelvin} is ${fahrenheit} degrees Fahrenheit.`); |
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
// Set human age | |
const myAge = 41; | |
// Set early years | |
let earlyYears = 2; | |
// Multiply the early years by 10.5 | |
earlyYears *= 10.5; | |
// Subtract 2 from current age since the age for |
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
daily_sales = \ | |
"""Edith Mcbride ;,;$1.21 ;,; white ;,; | |
09/15/17 ,Herbert Tran ;,; $7.29;,; | |
white&blue;,; 09/15/17 ,Paul Clarke ;,;$12.52 | |
;,; white&blue ;,; 09/15/17 ,Lucille Caldwell | |
;,; $5.13 ;,; white ;,; 09/15/17, | |
Eduardo George ;,;$20.39;,; white&yellow | |
;,;09/15/17 , Danny Mclaughlin;,;$30.82;,; | |
purple ;,;09/15/17 ,Stacy Vargas;,; $1.85 ;,; | |
purple&yellow ;,;09/15/17, Shaun Brock;,; |
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
destinations = ["Paris, France", "Shanghai, China", "Los Angeles, USA", "So Paulo, Brazil", "Cairo, Egypt"] | |
test_traveler = ['Erin Wilkes', 'Shanghai, China', ['historical site', 'art']] | |
def get_destination_index(destination): | |
""" | |
destination_index = -1 | |
for i in range(len(destinations)): | |
if destination == destinations[i]: | |
return i |
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
letters = ["A", "B", "c", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] | |
points = [1, 3, 3, 2, 1, 4, 2, 4, 1, 8, 5, 1, 3, 4, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, 10] | |
letter_to_points = {key.upper():value for key, value in zip(letters,points)} | |
letter_to_points[" "] = 0 | |
print(letter_to_points) |
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
toppings = ['pepperoni', 'pineapple', 'cheese', 'sausage', 'olives', 'anchovies', 'mushrooms'] | |
prices = [2, 6, 1, 3, 2, 7, 2] | |
num_pizzas = len(toppings) | |
print("We sell " + str(num_pizzas) + " different kinds of pizza!") | |
pizzas = list(zip(prices, toppings)) | |
print(pizzas) | |
pizzas.sort() | |
cheapest_pizza = pizzas[0] | |
priciest_pizza = pizzas[-1] | |
three_cheapest = pizzas[:3] |
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
hairstyles = ["bouffant", "pixie", "dreadlocks", "crew", "bowl", "bob", "mohawk", "flattop"] | |
prices = [30, 25, 40, 20, 20, 35, 50, 35] | |
last_week = [2, 3, 5, 8, 4, 4, 6, 2] | |
total_price = 0 | |
for price in prices: | |
total_price += price |
OlderNewer