-
Which of the following is a valid python variable?
a.
4legged = "dog"
b.
four_legged = "dog"
c.
4l = "dog"
-
Which is not a valid string?
a.
'joe's store'
b.
'joe\'s store'
c.
"joe's store"
d.
'''joe's store'''
-
How do I print "Lisa" in the following list?
names = ['Lisa', "Pedro", "Juan"]
a.
print(names[0])
b.
print(names[1])
c.
print(names[3])
-
What does
names.append("Carlos")
do to a list?a. adds "Carlos" to begining of list
b. adds "Carlos" to end of the list
c. adds "Carlos" to where the computer thinks is best
-
What does will the following print?
foo = True bar = False if foo or bar : print("fizz") elif foo and bar: print("buzz")
a.
"fizz"
b.
"buzz"
c. neither
-
How would print the daily special on Wednesday?
specials = { "Mon": "Pizza" "Tues": "Chinese" "Wed": "Mexican" "Thurs": "Fried Chicken" "Friday": "Burgers" }
a.
print(specials["Mon"])
b.
print(specials[2])
c.
print(specials[3])
d.
print(specials["Wed"])
-
What is following do?
colors = ["blue", "red", "white"] for color in colors: print(color)
a. prints "color" 1 time
b. prints "color" 3 times
c. prints each value "blue", "red" and "white" on a new line
-
You have the following folder structure.
spam/ __init__.py foo.py bar.py
Let's say your in the foo.py file. How do you import just bar and not everything under spam?
a.
import .bar
b.
from spam import bar
c.
import bar
-
Given the following code
class Animal: def walk(self): print("walks") class BigCat(Animal): def roar(self): print("roars") class Lion(BigCat): def eat_zebra(): print("eats zebra")
Is the following code valid?
lion = Lion() lion.walk()
a. True
b. False
Last active
January 12, 2022 00:21
Assessment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment