Boolean Expressions
Arithmetic Expressions
Find and Fix the Bug
Libraries &
Functions
what's the output?
conditionals
50

Given that:

a=True        b=True        c=True        d=True 

Evaluate:

a and (not b)  = ?

true and (not true) 

= true and false 

= false

50

x = int( 5 + 3.14)

print(x)

8

50

#Find the syntax error

num = 5

print("The number is: " str(num))

num = 5

print("The number is: " + str(num))

50

What is the math function to find the square root of a number

math.sqrt()

50

word = "Hi"

if word == "hi":

    print ("Hi")

else:

    print("Bye")

Bye

100

Given that:

a=True        b=True        c=True        d=True 

Evaluate:

not(a and b )

not (true and true)

= false

100

first = "Nothing"

last = "None"

name = first + "last"

print(name)

Nothinglast

100

#Find the logical error

bat = 5

#Print the value of bat after the prompt

print("value of bat: + bat")

bat = 5

print("value of bat: " + bat)

100

What data type does the input() command return?

String

Always a string

100

n = 5

if n >=10:

    print ("yes")

elif n >=5:

    print("maybe")

else:

    print("no")


maybe

200

Given that:

a=True        b=True        c=True        d=True 

Evaluate:

(not a and not b) or (c)

(not true and not true) or true

= false or true

= true

200

n = 5 + 2 / 2

print(n)

6.0

(6 is acceptable)

200

#Find the syntax error

x= integer(5.2)

y = x+ 5.2

x= int(5.2)

y = x+ 5.2

200

What is the math function in the math library for finding the absolute value of a number

math.fabs()

200

x = 10

if x % 10:

    print ("yes")

else:

    print("no")

no

(10%10 = 0, and if 0 is false)

300

Given that:

a = 15        b = 20        c = -1        d = 0

Evaluate:

(not (c < 0)) and (not(c>a))       

not(true) and not(false)

= false and true

=false

300

n = 8 * 8 / 2 + 3 - 2


33

300

#Find the syntax error

x = input(enter a decimal)

y = x+5

print("y")


x = input("enter a decimal")

y = x+5

print("y")

300

What is the library you need to import for random number functions?

import random

300

num = 7

if num < 10:

    print("hi")

elif num < 8:

    print("hello")

else:

    print("bye")


hi

400

Given that:

a = 15        b = 20        c = -1        d = 0

Evaluate:

(c * d)    >= (b * c)

0  >= -20

true

400

n = 51 % 3 * 10

0

400

#Find the syntax error

import math

n = maths.sqrt(16)

print("n")

import math

n = math.sqrt(16)

print("n")

400

random.random() generates a random number between ? and ?

0.0 and 1.0

(0 and 1 is an acceptable answer)

(0 inclusive, 1 not inclusive)

400

fav = 15

if fav < 20:

    print("less")

elif fav == 15:

    print("equal")

else:

    print("nothing to say")


less