Strings & Operators
Variables
Conditionals
Functions
Debug the Code
100

what are strings & operators?

string,a type of data used for storing and working with text

100

What is the purpose of variables in a code?

the purpose of a variable in a code is to keep track on

100

What does a Boolean expression evaluate?

True or False

100

what is a function?

A function is a named, self-contained block of reusable code designed to perform a specific task.

100

greeting = "Hello, world!"

print(greting)

print(greeting)because greeting is spelt wrong

200

when are strings & operators needed in coding?

strings and operators are needed when you need to represent texts and repeating and more.

200

Explain how a variable can work in a code?

 a variable works as a container used to store and retrieve data in a computers memory.

200

What is the purpose of an else statement?

A fallback when an if statement is false.

200

what does a function do?

encapsulate a specific block of logic so it can be organized, reused, and managed.

200

health = 100

if health = 0:

    print("Game Over")

Change the statement to use double equals: if health == 0:

300

what does a string do?

represent texts

300

var (clicks = 0)
         onEvent(“addOneButton.”, “click.
         Clicks = click + 1;
         setProperty(“counter” “text”, clicks); 

predict the output

the output is that each click is +1.

300

if (!isHungry || hasFood), what will

This check?

this will check if someone is not hungry OR has food to eat at lunch.

300

what parts do functions take place in coding?

functions are blocks of code designed to do specific tasks.  

300

def calculate_average(test1, test2):

    average = test1 + test2 / 2

    return average

Group the addition before dividing: average = (test1 + test2) / 2

400

do you have to have strings & operators?

no

400

score = 12
         bonus= 3

         Score = score + bonus. What are the final values of score and
         Bonus after the code runs? Explain how the variable change.

score :15
Bonus = 3

400

var temperature = 75;

if (temperature  => 80) {

  console.log("Hot");

} else if (temperature > 60) {

  console.log("Warm");

} else {

  console.log("Cold");}

What is the code telling us?

The code is telling us the weather is warm

400

How do functions go in order?

 in sequential order

400

score = 150

if score <= 50:

    print("Bronze Rank")

elif score <= 100:

    print("Silver Rank")

elif score <= 150:

    print("Gold Rank")

Order them from highest value to lowest, so the higher conditions don't get blocked by the broad score >= 50 condition:

500

how do springs & operators take part in coding?

to store, combine, and change text data

500

score1 = 72
         Score 2 = 55

         Score 3 = 83

         Total = score1+score 2+score 3
          Average = total /2

Find the mistakes

the mistakes are the average is calculated by dividing the total of 2, but there are three scores.

Result is only assigned when the average is atleast 60. 


500

var score = 90;


if (score > 70) {

  console.log("Passing");

} else {

  console.log("Failing");}

Change the condition so that a score of exactly 70 also prints "Passing."

500

How do you know when your function is set?

when it satisfies a specific set of function, structural, and behavioral criteria.

500

player_gold = 100


def add_bonus(gold):

    gold = gold + 50

add_bonus(player_gold)

print(player_gold)

Return the updated value from the function, and assign it back to the variable on the outside