Conditional Statements
Modulo
Errors
Lists
Data Types
100

Which part of the statement is the condition? 


If I am hungry, I will eat an apple

If I am hungry 

100

You have 5 cupcakes and 3 friends. How many cupcakes will you have left if each friend has an equal amount of cupcakes?

5%2 = 

2

100

The process of fixing errors is called...

debugging 

100

Each value in a list is called...

an item

100

What sign is equals to?

==

200

What does an if statement check for?

If the condition is true. 
200

You have 10 cupcakes and 5 friends. How many cupcakes will you have left over if each friend receives an equal amount?

10%5 = 

0

200

This error occurs when you have violated the rules of python syntax. It can't understand what you are trying to do. 

Syntax error

200

What number do you start with in indexing?

0

200

What sign is does not equal?

!=

300

What kind of statement is this?


If it's sunny, I'll go outside. Else, I'll stay inside.

Else statement

300

Now you have 9 cupcakes and 4 friends. How many cupcakes will you have left over if each friend receives an equal amount?


9%4 = 

1

300

What type of error is this? 

numerator = 10

denominator = 0

result = numerator / denominator

print(result)

run time error, because it is happens when the code tries to perform an operation that is not allowed. 

300

How do you get access to the length of a list?

len

300

What is a string

""

400

How do you end an ELIF statement?

With an else

400

Now you have 4 cupcakes and 7 friends. How many cupcakes will you have left over if each friend receives an equal amount?

4%7 = 4

400

What kind of error is this?


# Program to calculate the average of two numbers

a = 5

b = 7


average = a + b / 2   # Incorrect calculation of average, it should be (a+b)/2

print("The average of", a, "and", b, "is", average)

Logical error, because it the code does not produce the expected output due to incorrect logic or algorithm. 

400
What will print in the console? 


my_list = ["a", "b","c"]

print(my_list[1])


b

400

What is a float?

An decimal 

500

What will print in the console?

num = 200

if num > 50: 

    print("This is a big number!")

else: 

    print ("This is a small number!")

This is a big number!

500

Now you have 10 cupcakes and 2 friends. How many cupcakes will you have left over if each friend receives an equal amount?

10%2 = 0

500

What are the steps to fixing errors?

  1. Read the error message carefully: When an error occurs, the computer will usually give you an error message that explains what went wrong.

  2. Identify the line(s) of code causing the error: The error message will usually give you a line number or point to the specific line(s) of code that caused the error. 

  3. Use print statements: You can use print statements to help debug your code. You can add print statements to the code to check the values of variables or to see if the code is executing as expected.

  4. Test the code: Students should test their code by running it with different inputs to see if it produces the expected results.

  5. Repeat the process: If the code still doesn't work, you should repeat the process, starting from step 1, until you find and fix the error.

500

What will print in the console? 

str_list = [“p”, “r”, “o”, “b”, “e”]

print(str_list[0])

print(str_list[4])

print(str_list[-5])

p

e

p

500

7 is what kind of data type?

integer