OPERATORS
IF STATEMENTS
LOOPS
VARIABLES
LISTS
100

What is the difference between "=" and "=="

"=" is assignment
"==" is relational/comparison

100

If statement used when checking conditions sequentially

if-elif-else

100

When would you use a FOR LOOP

when you have a known number of iterations

100

Convert 5.8 to a integer

int(5.8) = 5

100

What list operator is used to convert a list to a string with "," as a separator

",".join(list)

200

What is the correct order of operations for relation and boolean operators

Relational
not
and
or

200

What kind of if statement is this:

if citizenship == True:

    if age >= 18:

        print("You are eligible to vote")

Nested if

200

What does "break" do

immediately stops the loop it is in

200

Is there an error? If so, where?

The error of the code:

(int("73.5") - float("2")) * 5

int("73.5")

200
What does c represent in:


myList[a:b:c]

Step size

300

Value of a in:

a = 3             b = 2             c = 7

a += c

a *= b

a = a**3

8000

300

Is there an error? If not, what is the output:

x = 0

if x = 5:

    print("Five")


Error "x=5" needs to be "x==5"

300

What is the output:

i = 0

while i < 10:

    print(i*2)

Infinite Loop

300

Would this result in an error? If no, what is the result?

mystring = "hi"

print(bool(mystring))

No error

output: True

300

What is the output of:

mylist = [100,32,43,25,1,82]

num = mylist.pop(3)

print(num*4)

100

400

Convert this interval notation to python code:

if x is in ( - infinity, 10] U [30 , 50)

if (x <= 10) or (x>= 30 and x<50)

400

Output of:

a = 15

if not(a != 30 or a>15):

    print("True")

else:

    print("False")

False

400

What is the output:

for i in range(1,5,2):

    value = i**2 

    print(value)

1

9

400

Output of:

(float("3.2") + int("4")) / 2

"3.6"

400

What is the output of this code: 

newlist = ["a","b","c","d","e","f"]

newlist[1:5]=["x","y"]

print(newlist)

['a', 'x', 'y', 'f']

500

What is the output of this code

a = 1

b = 3

c = 5

math = int(c // 5 ** b - a * 0.5)

print(math)

0

500

predict the output:

GPA = 3.5

credit = 18

if GPA >=2.0:

    standing = "In Good Standing"

    if GPA >= 3.5 and credit >= 12:

        standing = "Dean's List"

        if GPA >= 3.9 and credit >= 15:

            standing = "President's List"

print(standing

Dean's list

500

How many times does this loop run

count = 0

for i in range(5):

    for j in range(i):

        count += 1

print(count)


10

500

What is the output:

from math import*

number = float(bool("True")+15/3*e**(bool()))

print(number)

6.0

500

What is the output of this code

list1 = [0,1,2,3,4,5]

list2 = [6,7,8,9,10]

for i in range(len(list2)):

    list1.append(list2[i])

print(list1)

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]