# Popcorn Hack 1
weather = "sunny"
transportation = "available"
boots = "not present"
location_determined = "Yes the location is determined"
print("The weather is " + weather)
print("Your transportation is " + transportation)
print("Your boots are " + boots)
print("Location determined: " + location_determined)
if weather == "sunny":
if transportation == "available":
if boots == "present":
print("You are ready to go hiking!")
if location_determined == "yes":
print("You are ready to go hiking!")
else:
print("You need to find a hiking location first.")
else:
print("You need to find your boots first.")
else:
print("You need to arrange transportation.")
else:
print("It's not good weather for hiking.")
The weather is sunny
Your transportation is available
Your boots are not present
Location determined: Yes the location is determined
You need to find your boots first.
// Popcorn Hack 2
%%javascript
let weather = "sunny";
let transportation = "available";
let boots = "not present";
let location_determined = "Yes the location is determined";
console.log("The weather is " + weather);
console.log("Your transportation is " + transportation);
console.log("Your boots are " + boots);
console.log("Location determined: " + location_determined);
if (weather === "sunny") {
if (transportation === "available") {
if (boots === "present") {
if (location_determined === "Yes the location is determined") {
console.log("You are ready to go hiking!");
} else {
console.log("You need to determine the hiking location first.");
}
} else {
console.log("You need to find your boots first.");
}
} else {
console.log("You need to arrange transportation.");
}
} else {
console.log("It's not good weather for hiking.");
}
# Homework Hack 1: Write Python pseudocode to decide whether or not to go to the beach.
set weather to "sunny"
set sunscreen to True
set snacks to False
IF weather IS "sunny" THEN:
IF sunscreen IS True THEN:
IF snacks IS True THEN:
PRINT "You are ready to go to the beach!"
ELSE:
PRINT "You need to pack some snacks."
end of if statement
ELSE:
PRINT "You need to pack some sunscreen."
end of if statement
ELSE:
PRINT "It's not good weather for the beach."
end of if satement
# Homework Hack 2 Python: Adopt a pet
age = 18
space = 70
available = True
money = 100
if age >= 18:
if space >= 50:
if available == True:
if money >= 100:
print("You can adopt a pet!")
else:
print("You need to have enough money to adopt and take care of a pet ")
else:
print("You need to have time to spend with the pet")
else:
print("You need to have enough space for the pet")
else:
print("You need to be at least 18 to adopt a pet")
You can adopt a pet!
# Homework Hack 3 Python: Should you participate in a marathon?
weather = "clear"
running_shoes = True
days_practiced = 10
stamina = 10
if weather == "clear":
if running_shoes == True:
if days_practiced >= 10:
if stamina >= 5:
print("You should participate in the marathon!")
else:
print("You need to work on your stamina before participating in the marathon.")
else:
print("You need to practice more before participating in the marathon.")
else:
print("You need running shoes to participate in the marathon.")
else:
print("The weather is not good for running a marathon.")
You should participate in the marathon!
// Homework Hack 1 Javascript: Javascript pseudocode to decide whether or not to study for an exam.
SET study_materials to TRUE
SET have_quiet_place TO True
SET feeling_tired TO False
IF have_study_materials IS True THEN:
IF have_quiet_place IS True THEN:
IF feeling_tired IS False THEN:
PRINT "You are ready to study."
ELSE:
PRINT "You should take a nap or rest first."
end of if statement
ELSE:
PRINT "You should find a quiet location."
end of if statement
ELSE:
PRINT "You need to gather your study materials first."
end of if statement
// Homework Hack 2 Javascript: Javascript code deciding whether or not you can bake a cake.
let flour = true;
let eggs = true;
let sugar = true;
let frosting = false;
let oven_working = true;
let time_available = 5;
if (flour === true && eggs === true && sugar === true) {
if (oven_working === true) {
if (time_available >= 2) {
if (frosting === true) {
console.log("You can bake a cake without frosting.");
}
else {
console.log("You can bake a cake with frosting.");
}
} else {
console.log("You don't have enough time to bake a cake.");
}
} else {
console.log("Your oven is not working. You can't bake a cake.");
}
} else {
console.log("You are missing ingredients. You can't bake a cake.");
}
// Homework Hack 3 Javascript: Camping trip
let weather = "clear";
let tent = true;
let food = true;
let water = true;
let bug_spray = false;
if (weather === "clear") {
if (tent === true) {
if (food === true && water === true) {
if (bug_spray === true) {
console.log("You are ready for your camping trip!");
} else {
console.log("You need to pack bug spray.");
}
} else {
console.log("You need to pack more food and water.");
}
} else {
console.log("You need to pack a tent.");
}
} else {
console.log("The weather is not good for camping.");
}