Name the 3 most common data types for variables we have used
What are the int, float, string data types?
Your conditions in an 'if' statement will be evaluated as and is considered...
What is a Boolean Expression! and True or False?
What are the two loops we went over?
what are the 'for loops' and 'while loops'
Keyword you need in functions
def
Name the 4 different times of aggregate data
lists, sets, tuples, dictionaries
In order to concatenate two strings together this is used and to concatenate a string and number?
What is the + sign to concatenate two strings is and what is the (comma) , to concatenate a string and number?
The following type of variable n is ..
n= input("Enter something")
What is a string?
What is the sequence that is given by range(10)
what is 0,1,2,3,4,5,6,7,8,9
What are the things you pass into a function called?
Which data aggregate can also be described as key:value pairs.
Dictionary
The escape sequence that is used to create a horizontal tab..
What is a \t (for tab)
to cast the input from string to FLOAT in the following statement
n = input("Enter some numbers here")
What is n = float(input("Enter some numbers here"))
How do you make sure your while loop does not turn into an infinite loop?
Make sure you increment a variable and/or cause the condition to eventually become false
How do you call a function?
function_name()
Which aggregate uses parenthesis and which uses curly brackets?
-not including dictionary
parentheses: tuples
curly brackets: sets
Using the % symbol the following will equal
47 % 3
what is 2, the remainder of 3 * 15?
What will print?
a = True
b = False
if a and b:
print("Hello World")
else:
if not(a and b):
print("Hi World")
else:
print("What’s up World")
what is "Hi World"
Using a for loop, how would you print out the numbers 0-10
for i in range(11):
print(i)
What is wrong here?
def multiply(x,y,z):
return x*y*z
print(“The answer is “, x*y*z)
There is something after the return statement; Return statements should always be last!
list = [ [1,2,3], [4,5,6], [7,8,9] ]
What value is list[2][1]
8
The following conditions will equate to?
not True or True and not False or False
What is "True"
I want to check if a number is odd, what is the condition:
num = int(input("Enter a number here"))
if _______:
print("This is an odd number")
else:
print("This is an even number")
what is num % 2 == 1
Describe how you would print out the numbers from 1-10 using a while loop.
num = 1
while (num <=10):
print(num)
What will be the following output?
def square(x):
y = x * x
return y
print(square(square(2)))
16
How can I append a value to a list?
list = []
value = 7
list.append(value)