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, choice | |
def throw_poke_ball(): | |
return randint(1, 5) | |
available_pokemon = [ | |
"Pikachu", | |
"Eevee", |
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 | |
#FUNCTIONS | |
def display_banner(): | |
welcome = """ | |
Welcome to the Math Quiz! | |
You'll start with three lives. | |
Each round, you'll be asked to solve a math problem. |
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 add_ghost(x, y, animate_vertical): | |
ghost = add_image("ghost.png", 50) | |
position_element(ghost, x, y) | |
# If we want to animate veritcal | |
animate_down(ghost, 100, 2, True) | |
# Otherwise | |
animate_right(ghost, 100, 2, True) | |
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
""" | |
################ HINTS ##################################### | |
Create an app that models a slot machine. | |
- Our user needs tokens to play the slot machine, so create a variable to hold | |
these tokens and store as many as you wish at the start of the app. | |
- Track the number of rounds the user plays in a variable as well. | |
- Create a loop that runs while the user has tokens. |
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 | |
number_streak = 0 | |
while True: | |
user_choice = int(input("Guess a number between 1 and 100: ")) | |
random_number = randint(1,100) | |
if user_choice == random_number: | |
number_streak += 1 |
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
""" | |
################ HINTS ##################################### | |
Create an app that simulates a simple game of twenty-one. | |
- You'll need two players. One should be the dealer, the other should be the | |
player (user). | |
- You'll need to generate random numbers, so import the correct function | |
from the correct module. | |
- Assume each round a player can draw a card from 1-10, and simulate two |
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
""" | |
################ HINTS ##################################### | |
Create an app that simulates a simple game of twenty-one. | |
- You'll need two players. One should be the dealer, the other should be the | |
player (user). | |
- You'll need to generate random numbers, so import the correct function | |
from the correct module. | |
- Assume each round a player can draw a card from 1-10, and simulate two |
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
span { | |
color: white; | |
display: block; | |
} |
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 save_search_results(search_term, artworks, books, articles, username): | |
... | |
search_results[username][search_term] = { | |
... | |
} | |
# Open the search-results.json file in write mode | |
with open(___, mode=___) as json_file: | |
# Save the search_results to the search-results.json file |
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 save_search_results(search_term, artworks, books, articles, username): | |
... | |
if ___.get(___) is None: | |
... | |
# Add the search_term key to the username dict on the | |
# the search_results dict | |
search_results[username][search_term] = { | |
"artworks": ___, |