This file contains 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
lloyd = { | |
"name": "Lloyd", | |
"homework": [90.0, 97.0, 75.0, 92.0], | |
"quizzes": [88.0, 40.0, 94.0], | |
"tests": [75.0, 90.0] | |
} | |
alice = { | |
"name": "Alice", | |
"homework": [100.0, 92.0, 98.0, 100.0], | |
"quizzes": [82.0, 83.0, 91.0], |
This file contains 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
""" | |
Learn Python - Rock, Scissors, Paper Game! | |
""" | |
from random import randint | |
options = ["ROCK", "PAPER", "SCISSORS"] | |
message = { | |
"tie": "Yawn it's a tie!", | |
"won": "Yay you won!", |
This file contains 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
shopping_list = ["banana", "orange", "apple"] | |
stock = { | |
"banana": 6, | |
"apple": 0, | |
"orange": 32, | |
"pear": 15 | |
} | |
prices = { |
This file contains 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
""" | |
Planning a trip | |
""" | |
def hotel_cost(nights): | |
return 140 * nights | |
def plane_ride_cost(city): | |
if city == "Charlotte": | |
return 183 |
This file contains 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
// Function Expression with variable function's name, ()'s holding two parameters, and {} body | |
const isGreaterThan = (numberOne, numberTwo) => { | |
// Conditional statement to see if parameter1 is greater than parameter2 | |
if (numberOne > numberTwo) { | |
return true; | |
} else { | |
return false; | |
} | |
// Adding semi colon since we are holding this function within a variable | |
}; |
This file contains 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
// Declaring function with keyword 'function', function's name, ()'s holding two parameters, and {} body | |
function isGreaterThan (numberOne, numberTwo) { | |
// Conditional statement to see if parameter1 is greater than parameter2 | |
if (numberOne > numberTwo) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
This file contains 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
// Variable which can change to hold number of pizza orders | |
let orderCount = 0; | |
// Function for placing pizza orders including toppings & crust type | |
const takeOrder = (topping, crustType) => { | |
// Increment the order numbers by one each time function is called | |
orderCount++; | |
// Print the type of pizza ordered after the function is called | |
console.log(`Orders: ${crustType} pizza topped with ${topping}`); | |
} |
This file contains 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
const getUserChoice = (userInput) => { | |
userInput = userInput.toLowerCase(); | |
if (userInput === 'rock' || userInput === 'paper' || userInput === 'scissors' || userInput === 'bomb') { | |
return userInput; | |
} | |
else { | |
console.log('Invalid Option'); | |
} | |
}; |