Recite the first 8 numbers of the Fibonacci Sequence!
0, 1, 1, 2, 3, 5, 8, 13
You know the code is part of the if/while/for loop if the code is ________.
Indented
len()
What is the correct order these statements should go in?
elif, else, if
if, elif, else
Is this code valid?
for potato in "potato":
print(potato)
What is # used for in python?
to write comments
Name the four simple data types.
int, float, String, boolean
What is the syntax to create a list?
list_name = []
Add programmer to this list....
careers = ["doctor", "teacher", "accountant"]
careers.append("programmer")
Which of the following does not have a Boolean expression: for, while, if
for
for i in range (100):
print (i)
would print the numbers from ___ to ____ inclusive.
0 to 99
If you convert a float (5.6) to an integer, what number will that integer be?
5
What does this print?
print("3" * 3)
333
What is a python data type that represents numbers with decimal points?
float
How would you convert a variable, n, to an integer?
int(n)
What does this code print?
if (10 > 5):
print("Yay!")
elif (10 > 2):
print("booo")
Yay!
What type of loop should you use if the number of iterations is unknown.
while
DAILY DOUBLE!
Name these symbols!!!
{} [] : ()
Curly Bracket, Bracket, Colon, Parentheses
DAILY DOUBLE!
What is the % called?
and
What is 6 % 4?
modulous, 2
How many boolean operators are there and what are they?
6: !=, ==, >=, <=, <, >
What data type does the input() function return?
String
What does this code print out?
grade = 93.
if (grade > 93):
print("A")
else:
print("F").
F
What does a nested for loop look like?
for ____
for ____
What does the 'cd' command stand for?
change directory
Write a line of code that takes a user input and assigns it to a variable called favorite_food.
favorite_food = input("What is your favorite food?")
Find the error in the code:
list1 = ["Mango", "Pineapple", "Pear"]
print(list1[len(list1) / 2])
//
What parameter in a print() function can we use to override the print statement's default new line ending?
end=""
Is this code valid?
elif (10 > 5):
print("X")
else:
print("Y")
NO!
What statement allows you exit a loop early?
break
list1 = [10, 20, 30]
list1[1] = list1[2] + 5
[10, 35, 30]
What does this code print?
print("coast"[::2])
cat
What is slice notation?
[1:4]
What does .lower() do?
-_-
True or False:
not (True and False) =
True
What does this code print out?
for row in range(6):
for col in range(row+1):
print("*", end ="")
print("")
*
**
***
****
*****
******
What does list1 equal after running this code?
list1 = [1, 2, 5, 10]
list1.pop(2)
[1, 2, 10]