Boolean
Python Functions/Methods
Python Symbols
Python Code
Vocabulary
100

What is a boolean?

A Python data type that represents if a statement is True or False.

100

You type this to tell Python that you are creating a function.

def

100

This is the operator used to concatenate.

+ (addition operator)

100

4**2/4 is equal to this number.

4

100

What is a python data type that represents whole numbers.

Integer (int, ex: 4, 12, 3)

200

What boolean operator do we use to check if one value is not equal to another value?

!= (not equal to)

200

Name 2 methods that can mutate a list

insert, append, del

200

What will be displayed on the console:

print("Hello! ")

#print("Nice to meet you!)

Hello! 

#print("Nice to meet you!) is a line of comment (# symbol is for comment) that won't be executed by Python.

200

What will be returned when the code finishes running?

def fun(a)

if a > 30:

return 5

else

return 10 + fun(a + 5)

fun(10)

65
200

What is a base case in recursion?

It is the condition in which the recursive function will stop executing.

300

What is the difference between "and" and "or" in python?

"and" only returns True when BOTH statements are True.

"or" returns True if one or more statement is true and False if both statements are false

300

What is wrong with the following code:

num = input("Please enter your num: ")

It should be num = int(input("Please enter your num: "))

300

What is the difference between // and /?

// - integer division

/ - decimal division

300

What is the result of the following code: print((6**2 - 4 * 2) % 5)

3

300

What are the naming conventions we use in python?

camelCase and under_scores

400

Name at least 4 comparison operators you can use in an if statement. One example: ==

==, <, >, !=, <=, >=

400

What will be displayed on the console:

def sayHello (name):

        return("Hello, " + name)

sayHello("Macy")

Nothing. 

The function sayHello is returning, but not printing. If you want to print the value returned by the function sayHello on the console, you should type:

print(sayHello("Macy"))

400

What symbol do you use to computer remainder?

% (the modulus symbol)

400

What will be the output of the following block of code:

count = 1

while (count < 5):

      print("Nice to meet you!")

      count = count + 1

Nice to meet you!

Nice to meet you!

Nice to meet you!

Nice to meet you!

400

What operator has the highest precedence in python?

( ) parenthesis

500

What is the result:

x = 12

y = 12.0

print(("apple" == "Apple" or x < 10) and x == y)

False

500

What is wrong with the following header of a function in Python:

def functionOne arg1, arg2, arg3

There should be parathesis surrounding the parameters, and there should be colon at the end.

It should be:

def functionOne (arg1, arg2, arg3):

500

What symbols are used to create a list?

[ ] (brackets)

500

What is wrong with the following block of code:

i = 10

while (i > 5):

     print("Hi!")

     i = i + 1


This results in an infinite loop. Since i starts from 10 and we are increasing the value of i using i = i + 1, this will make the condition i > 5 always True (there will never be a moment when i is less than or equal to 5), which results in an infinite loop.

500

What is the difference between parameter and argument in Python function?

A parameter is the variables listed in the header. An argument is the real value passed to the function when the function is called.

M
e
n
u