Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 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 |
This file contains hidden or 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
# 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"] |
This file contains hidden or 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
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. |
This file contains hidden or 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
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: ")) |
This file contains hidden or 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
welcome_banner = """Welcome to MyFace | |
""" | |
print(welcome_banner) | |
username = input("put in the username or else: ") | |
password = input("put in the password or else: ") | |
This file contains hidden or 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
########################## BEGIN FUNCTION DEFINITIONS ###################### | |
def view_all_contacts(): | |
for name, num in contacts.items(): | |
print(f"{name}'s phone number: {num}") | |
def view_contact(): | |
pass |
This file contains hidden or 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
########################## 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 |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
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) |
NewerOlder