Skip to content

Instantly share code, notes, and snippets.

View daniel-schroeder-dev's full-sized avatar

Daniel Schroeder daniel-schroeder-dev

  • PFES/Entergy/CodeWizardsHQ
  • New Orleans, LA
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def get_all_requests():
connection = get_db()
sql = connection.cursor()
result = sql.execute("""select * from requests""")
requests = result.fetchall()
requests = convert_sqlite_row(requests)
for request in requests:
receiver_result = sql.execute("""select first_name from users where user_id = ?""", [request["receiver"]]).fetchone()
request["first_name"] = receiver_result["first_name"]
return requests
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Created April 6, 2023 13:39
How to populate request dictionary with usernames
# Loop through all requests
for request in requests:
# Query the DB to get the username of the receiver in this request
query = """
SELECT username FROM users WHERE user_id = ?;
"""
result = sql.execute(query, [request["receiver"]]).fetchone()
# Add the username to the request dictionary
request["username"] = result["username"]
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Created August 14, 2022 21:53
Nathany - Math Quiz
from random import randint
def display_welcome_banner():
welcome_banner = """
Welcome to the Math Quiz!
You'll start with three lives.
Each round, you'll be asked to solve a math problem.
If you solve the problem correctly, you won't lose any lives.
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Last active August 14, 2022 21:46
Nataliaw - Guess the Number
from random import randint
random_number = randint(1, 10)
offset = 2
upper_bound = random_number __ offset # This should be higher than the random_number
lower_bound = random_number __ offset # This should be lower than the random_number
guess = int(print("Guess a number between 1 and 10: "))
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Created August 14, 2022 21:24
Nataliaw - User Login
welcome_banner = """Welcome to MyFace
"""
print(welcome_banner)
username = input("put in the username or else: ")
password = input("put in the password or else: ")
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Last active August 5, 2022 23:25
Class Gist - H112 - Lesson 10
########################## BEGIN FUNCTION DEFINITIONS ######################
def view_all_contacts():
for name, num in contacts.items():
print(f"{name}'s phone number: {num}")
def view_contact():
pass
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Last active August 3, 2022 22:06
Morra - Kendrick
########################## BEGIN FUNCTION DEFINITIONS ######################
from random import randint
########################## END FUNCTION DEFINITIONS ######################
game_rules = """
Welcome to Morra! In this game, you'll decide how many fingers
to hold up (from one hand) and then the computer will randomly
do the same. You'll need to guess the total number of fingers
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Created July 29, 2022 14:49
Kathir - Reminder App
# Reminder app
# Have a DB of reminders
# CRUD for reminders
# Web App
# Notifications with popups/sound
# No user accounts/No roles/Personal app
# Tech Stack
@daniel-schroeder-dev
daniel-schroeder-dev / main.py
Created July 28, 2022 21:42
Danial - Guess The Number
from random import randint
welcome_banner = """
Welcome to guess the number!!! The rules are simple all you have to do is
guess the correct nuumber and then you will win a prize!!!
"""
print(welcome_banner)
max_num = 10
random_number = randint(1, max_num)