Skip to the content.

Conditions

What is conditions? Conditional Statements are what happens next in the program when a certain condition is met.

Homeworks

Before starting the options,

Option 1: Grade Checker

Example for the grade checker:

“F” if the grade is below 60. “D” if the grade is between 60 and 69. “C” if the grade is between 70 and 79. “B” if the grade is between 80 and 89. “A” if the grade is 90 or above.

Option 2: Weather app

Example for a weather app:

If the weather is sunny, print: “It’s a great day to go outside!” If the weather is rainy, print: “Don’t forget your umbrella!” If the weather is snowy, print: “Stay warm and safe!”

Option 3: Your idea

Make any If-Then, If, or Then-If statements with different ideas.

Tips:

Format:
%%js
//Time to get creative
//DEADLOCK QUIZ

let answer1 = "haze"
let answer2 = "lash"
let answer3 = "kinetic pulse"
let answer4 = "The Cursed Apple"
let answer5 = "Ava"


console.log("Question 1: Who is the best character in the game?")

if (answer1 === "haze" || answer1 === "Haze"){
    console.log("Correct! Next question")
} else {
    if (Math.random()>0.9){
        console.log("Not quite. We're on a time crunch though, so move on for now.")
    } else {
        console.log("Not quite! Let's move on for now.")
    }
    
}


console.log("Question 2: Who is the coolest character in the game?")

if (answer2 === "lash" || answer2 === "Lash"){
    console.log("Correct! Next question")
} else {
    if (Math.random()>0.9){
        console.log("Not quite. We're on a time crunch though, so move on for now.")
    } else {
        console.log("Not quite! Let's move on for now.")
    }
    
}

console.log("Question 3: What is Dynamo's 1 ability?")

if (answer3 === "kinetic pulse" || answer3 === "Kinetic Pulse"){
    console.log("Correct! Next question")
} else {
    if (Math.random()>0.9){
        console.log("Not quite. We're on a time crunch though, so move on for now.")
    } else {
        console.log("Not quite! Let's move on for now.")
    }
    
}

console.log("Question 4: What's the name of the map the game takes place in?")

if (answer4 === "The Cursed Apple" || answer4 === "the cursed apple"){
    console.log("Correct! Next question")
} else {
    if (Math.random()>0.9){
        console.log("Not quite. We're on a time crunch though, so move on for now.")
    } else {
        console.log("Not quite! Let's move on for now.")
    }
    
}


console.log("Question 5: What's Calico's cat named?")

if (answer5 === "ava" || answer5 === "Ava"){
    console.log("Correct! Next question")
} else {
    if (Math.random()>0.9){
        console.log("Not quite. We're on a time crunch though, so move on for now.")
    } else {
        console.log("Not quite! Let's move on for now.")
    }
    
}
<IPython.core.display.Javascript object>