diff --git a/conditionals.py b/conditionals.py index f3a9a63..4cd3aba 100644 --- a/conditionals.py +++ b/conditionals.py @@ -102,9 +102,9 @@ print("------------------- Challenge 4 -------------------") # Prompt the user to enter the day of the week (1-7 representing Monday - Sunday) - # Write a set of conditionals that will take a number from 1 to 7 - # and print out the corresponding day of the week. - # Make sure to add a statement that accounts of any numbers out of range! */ +# Write a set of conditionals that will take a number from 1 to 7 +# and print out the corresponding day of the week. +# Make sure to add a statement that accounts for any numbers out of range! @@ -118,21 +118,20 @@ # -------------------------------------------- -print("------------------- Challenge 1 -------------------") +print("------------------- Challenge 5 -------------------") # A leap year is a calendar year that contains an additional day added - # to keep the calendar year synchronized with the astronomical year or seasonal year. - # To calculate if a specific year is/was a leap year, you can follow the following steps: +# to keep the calendar year synchronized with the astronomical year or seasonal year. +# To calculate if a specific year is/was a leap year, you can follow the following steps: # 1. If the year is evenly divisible by 4, go to step 2. Otherwise, go to step 5. # 2. If the year is evenly divisible by 100, go to step 3. Otherwise, go to step 4. # 3. If the year is evenly divisible by 400, go to step 4. Otherwise, go to step 5. # 4. The year is a leap year (it has 366 days). # 5. The year is not a leap year (it has 365 days). - # Those are a lot of conditions... - - # Your challenge is to translate the steps above into conditionals which will evaluate if the - # year stored in a variable is/was a leap year. +# Those are a lot of conditions... +# Your challenge is to translate the steps above into conditionals which will evaluate if the +# year stored in a variable is/was a leap year. diff --git a/debugger.py b/debugger.py index 22ef881..00a34c7 100644 --- a/debugger.py +++ b/debugger.py @@ -1,7 +1,5 @@ import random -options = ["rock", "paper", "scissors"] - print("Let's play Rock Paper Scissors!") # Challenge @@ -9,13 +7,12 @@ while True: userInput = input("Do you want to play rock, paper, or scissors?\n").lower() - randomSelection = random.randint(0, 2) - computerSelection = options[randomSelection] + computerSelection = random.choice(["rock", "paper", "scissors"]) print(f"You played: {userInput} and the computer played: {computerSelection}") if userInput == computerSelection: print("It's a tie!") - elif((userInput = "rock" and computerSelection = "paper") or (userInput = "paper" and computerSelection = "scissors") or (userInput = "scissors" and computerSelection = "rock")): + elif((userInput = "rock" and computerSelection = "paper") or (userInput = "paper" and computerSelection = "scissors") or (userInput = "rock" and computerSelection = "scissors")): console.log("You Lose!") elif: console.log("You Win!") diff --git a/dictionaries.py b/dictionaries.py index 4a649a3..35c63aa 100644 --- a/dictionaries.py +++ b/dictionaries.py @@ -2,17 +2,14 @@ # # Team Edge dictionaries: Dictionaries CHALLENGES # - # For this activity, you will be building a dictionary and with properties - # and methods. You will access the properties, set new values, and use - # the methods to change your dictionary state. What dictionary? Ask your coach. + # For this activity, you will be building a dictionary with properties. + # You will access the properties, set new values. + # What dictionary? Ask your coach. # # 1. DEFINE: Make a dictionary and set its properties, printing changes in between. # 2. MODIFY: Add 2 new properties and assing values. Change existing values, # including adding or updating values inside lists - # 3. METHODS: Now its time to make some methods. Then can simply make a change - # to your values, like a boolean, or they can print something about - # the dictionary. Nothing fancy, unless you fancy it. - # 4. LITERALLY: Use string literals to put it all together in one statement. + # 3. LITERALLY: Use string literals to put it all together in one statement. # # #########################################################################/ @@ -61,6 +58,7 @@ -print("------------------- CHALLENGE 4 : LITERALLY -------------------") +print("------------------- CHALLENGE 3 : LITERALLY -------------------") + +#-->TODO: Put it all together using a string literal to tell the story of your dictionary! -#-->TODO: Put it all together using a string literal to tell the story of your dictionary! \ No newline at end of file diff --git a/for_loops.py b/for_loops.py index 05944f3..da7b694 100644 --- a/for_loops.py +++ b/for_loops.py @@ -37,7 +37,7 @@ for x in colors: print("The color is: " + x) -#-->TODO: Declare a list with at least 10 animals. You provide the animals. +#-->TODO: Declare a list with at least 5 animals. You provide the animals. animals = [] #-->TODO: Print all the animals in the array with a for loop. @@ -47,7 +47,7 @@ print("------------------- CHALLENGE 3 : EVEN COUNTDOWN ------------------") -#This makes a random number between 0-50 +#The line below makes a random number between 0-50 and assigns it to the random variable random = random.randint(0, 50) #this if/else statement checks if the number is even using the modulo operator (%) @@ -56,10 +56,10 @@ else: print(str(random) + " is odd!") -#-->TODO: Write a function that counts BACKWARDS from 100 and prints only odd numbers +#-->TODO: Write a function that counts BACKWARDS from 100 and prints only even numbers -#-->TODO: Write a function that counts BACKWARDS from the given random number and prints only even numbers +#-->TODO: Write a function that counts BACKWARDS from the given random number and prints only odd numbers print("------------------- CHALLENGE 4 : Finder ------------------") @@ -69,15 +69,14 @@ if color in colors: print("Yes, that color is a fav") else: - print("No, that color is not one my favorites") + print("No, that color is not one of my favorites") #-->TODO Declare a list of any strings you want: cities, friends, movies, etc. -#-->TODO Prompt the user to "Guess" if an element is present. Store their response in a variable - -#-->TODO Write function to prompt the user and see if the element is present. If so, print CONGRATULATIONS! +#-->TODO Write function to prompt the user to "Guess" if an element is present in your list. Store their response in a variable. +# --> If their guess is in your list, print CONGRATULATIONS! #-->TODO Call your function. @@ -90,7 +89,7 @@ big_word = "antidisestablishmentarianism" print(f"{big_word} has {len(big_word)} letters") -#this is how you can nest for loops, one insde the other! These loop through all the colors, and then through all the characters in the color +#this is how you can nest for loops, one inside the other! These loop through all the colors, and then through all the characters in the color for color in colors: #for all the colors: print(color) diff --git a/functions.py b/functions.py index 8585b79..4daf540 100644 --- a/functions.py +++ b/functions.py @@ -77,7 +77,7 @@ # **** Challenge 2: Problem 2 **** -# Write a function called makes_10 that takes two numbers, a and b, and returns true if one if them is 10 or if their sum is 10. +# Write a function called makes_10 that takes two numbers, a and b, and returns true if one of them is 10 or if their sum is 10. # Examples: # makes_10(9, 10) → True @@ -123,7 +123,7 @@ # **** Challenge 2: Problem 4 **** -# Write a function that will tell if you if you received a speeding ticket. +# Write a function that will tell you if you received a speeding ticket. # You are driving a little too fast, and a police officer stops you. # To compute the result, encoded as a number value: @@ -143,4 +143,4 @@ -# Make sure to test your code! Write a few function calls to make sure your code works! \ No newline at end of file +# Make sure to test your code! Write a few function calls to make sure your code works! diff --git a/order_bot_project.py b/order_bot_project.py index a53716e..426818f 100644 --- a/order_bot_project.py +++ b/order_bot_project.py @@ -3,11 +3,11 @@ # You've just learned about variables, conditionals, functions, and user input. # You've also created a basic calculator in a previous project. - # Now imagine you are going out to eat with two other friends. + # Now imagine you are going out to eat. # Are you at a restaurant for a meal? Are you grabbing boba? Or are you just going to an ice cream parlor? - # At the end of the meal, you and your friends have to split the bill. + # At the end of the meal, you get the bill. - # Wouldn't it be great if we could automate that math? + # How do you think restaurants automate that math? # Let's try it! @@ -15,13 +15,19 @@ # Scenario Parameters: - # When you and your friends eat out, each of you have the option to order one or multiple items. - # What kind of items are available to order? + # When you eat out, you have the option to order one or multiple items. + # What kind of items are available to order? There's usually a menu. + # Allow your user to order a drink, meal, and dessert. - # At the end of the order, the receipt comes and you all have to calculate the cost for each person: + # At the end of the order, the receipt comes and you have to calculate the total cost: # Don't forget the tax and tip! -# After this program finishes running, it should output a specific total for each person +# After this program finishes running, it should output a receipt with: + #1. the items you ordered and their cost + #2. a total for your order before tax + #3. a total for your order after tax + #4. the amount of your tip + #5. the total including tax and tip # -------------------------------------------- @@ -29,13 +35,40 @@ # -------------------------------------------- # Part 1: -# Let's start by asking taking the order of the group(you and two friends). What did each person order? +# Let's start by creating the variables we'll need to keep track of the user's order +# as well as TAX and tip -# Write a function that will take the group's order: -# - Prompt the user to enter the price of each item they ordered +# Remember: Your user should be able to order at least 3 items (a drink, meal, and dessert item). + +# -------------------------------------------- + + + +# -------------------------------------------- + +# Part 2: +# Next, let's display the menu. Include the food item name and it's cost. + +# Write a function that will display the menu: +# - Print each item available and it's cost. You should have at least 3 items available (a drink, meal, and dessert item). + +# -------------------------------------------- + + + + + + +# -------------------------------------------- + +# Part 3: +# Let's take the order. What did the user order? What does it cost? + +# Write a function that will take the order: +# - Prompt the user to enter a drink, dessert, and meal (Bonus: give them the option to not order an item) # - Return the cost -# Remember! Functions are meant to be reusable, so write a function that will work when called for each person! +# Remember! Functions are meant to be reusable, so write a function that will work when called repeatedly! # -------------------------------------------- @@ -52,7 +85,7 @@ # -------------------------------------------- -# Part 2: +# Part 4: # Now that you have the costs of everything ordered, let's calculate the cost of each person's order(including tip and tax). # Write a function that will calculate the cost of each person's order, including: @@ -77,22 +110,31 @@ # -------------------------------------------- -# Part 3: +# Part 5: # Let's print out a receipt for each person. # Write a function that will take the values of each person's order and total cost and print it out in an appealing way. # The receipt should include: # - Cost of each item -# - Total cost for each person +# - Tax for the order +# - Tip for the order +# - Total cost for the order -# Remember! Functions are meant to be reusable, so write a function that will work when called for each person! # -------------------------------------------- +# -------------------------------------------- + +# Part 6: Food Order Bot + +# Call all of your functions to get your food order bot up and running! + +# -------------------------------------------- + @@ -101,14 +143,12 @@ # -------------------------------------------- -# Part 4: Upchallenges! +# Part 7: Upchallenges! # How many of these upchallenges can you implement? -# - Make sure the user is only entering numbers. If they enter an invalid value, prompt them to re-enter. +# - Make sure the user is only entering valid values. If they enter an invalid value, prompt them to re-enter. # - The displayed prices should only have two decimal places. -# - Can you adjust your program to account for any shared items ordered for the group? -# - Display the tax and tip values # - Implement a rewards system (stamp cards, buy one get one, etc) # -------------------------------------------- diff --git a/while_loops.py b/while_loops.py index 0404ab5..55dfdd4 100644 --- a/while_loops.py +++ b/while_loops.py @@ -100,7 +100,7 @@ def pattern(): -#-->TODO: Make a Math Quiz that asks two random numbers (between 0 and 100 to make it easy). +#-->TODO: Make a Math Quiz that adds two random numbers (between 0 and 100 to make it easy). # The user enters the answer. If wrong, keep prompting. If correct, say congrats!! # Use this handy boolean to get you started! You will need input()!