Skip to content

Instantly share code, notes, and snippets.

@TheMuellenator
TheMuellenator / conditionals.py
Created January 14, 2020 11:49
Python Conditional Statement Coding Exercise Solution
def is_it_prime(n):
#TODO: Write your code here.
for i in range (2, n):
if n % i == 0:
return False
else:
return True
from pprint import pprint
import requests
SHEETY_PRICES_ENDPOINT = YOUR SHEETY PRICES ENDPOINT URL
class DataManager:
def __init__(self):
self.destination_data = {}
@TheMuellenator
TheMuellenator / functions_part2.py
Last active March 16, 2023 17:44
Python Functions Coding Exercise - Part 2 Solution
# TODO 1: Add two parameters (length_ft and width_ft)
def calc_square_meters_from_feet(length_ft, width_ft):
# TODO 2: Modify the code below:
metric_length = length_ft * 0.3048
metric_width = width_ft * 0.3048
metric_area = metric_length * metric_width
@TheMuellenator
TheMuellenator / loops.py
Created January 14, 2020 11:47
Python Loops Coding Exercise Solution
def sing(num_bottles):
#TODO: Add your code to achieve the desired output and pass the challenge.
#NOTE: The f String method of String Interpolation does not work.
lyrics = []
for num in range(num_bottles, 0, -1):
lyrics.append('{num} bottles of beer on the wall, {num} bottles of beer.'.format(num = num))
lyrics.append('Take one down and pass it around, {num} bottles of beer on the wall.'.format(num = num - 1))
lyrics.append('')
return lyrics
@TheMuellenator
TheMuellenator / variables.py
Last active August 3, 2023 23:36
Python Variables Coding Exercise Solution
def test(A, B):
a = A
b = B
# TODO: Below this comment write your code.
c = a
a = b
b = c
@TheMuellenator
TheMuellenator / high_scores.py
Last active September 3, 2023 11:36
Python Lists Coding Exercise Solution
def top_three(scores):
scores = scores
top_scores = []
# Solution
scores.sort()
list_size = len(scores)
top_scores = [scores[list_size-1], scores[list_size-2], scores[list_size-3]]
@TheMuellenator
TheMuellenator / functions_part3.py
Last active January 13, 2024 02:30
Python Functions Coding Exercise - Part 3 Solution
# TODO: Write a function called concatenate_lists that has two parameters and returns the combined list.
def concatenate_lists(first_list, second_list):
result = first_list + second_list
return result
@TheMuellenator
TheMuellenator / functions_part1.py
Last active January 18, 2024 20:03
Python Functions Coding Exercise - Part 1 Solution
tracker = 0
def moveForwards():
global tracker
tracker += 1
print('moved forward by one step.')
def turnRight():
global tracker
tracker -= 1
@TheMuellenator
TheMuellenator / main.py
Last active June 17, 2024 14:29 — forked from angelabauer/main.py
Day 40 L354 - Solution for Customer Acquisition for the Flight Club
import sheety
print("Welcome to Angela's Flight Club.\n \
We find the best flight deals and email them to you.")
first_name = input("What is your first name? ").title()
last_name = input("What is your last name? ").title()
email1 = "email1"
email2 = "email2"
class FlightData:
def __init__(self, price, origin_city, origin_airport, destination_city, destination_airport, out_date, return_date):
self.price = price
self.origin_city = origin_city
self.origin_airport = origin_airport
self.destination_city = destination_city
self.destination_airport = destination_airport
self.out_date = out_date
self.return_date = return_date