What number system do we use everyday?
Decimal
Name two data types in Python
Numbers
String
Boolean
List
Tuple
Dictionary
What two loops have I taught you?
for loop and while loop
What do you use to take info from a user?
What number system is base 16?
Hexadecimal
What is the syntax for the conditional statement I taught you?
if condition:
#code
elif condition:
#code
else:
#code
Write a for loop to loop through 0-4 and print them out
for i in range(5):
print(i)
Find the length of s and print it out
s = "yayyyy"
print(len(s))
Convert 1010102 to decimal
4210
What is a module?
Contain variables, functions, and classes. Contains Python code.
Write a while loop to loop backward through 0 to -3
i = 0
while i>=-3:
print(i)
i--
check if s begins with hi and print the result
s = "hi buddy!"
print(s.startsWith("hi"))
Find f(12,6)
f(x,y)={
f(x-y, y-1)+2 when x>y
x+y otherwise
}
9
What do you use to gain access to other modules?
An import statement
What do you use to leave a loop early?
break
Find the character at the last index of s and store it in a new variable
s = "hi hi hi"
c = s[len(s)-1]
Convert 100016 to octal
100008
Name a keyword in python
and, break, else, continue, for, if, while, elif, while, or, not, etc.
Convert this to a for loop
i = 0
while i>-2:
print(i)
i--
for i in range(0, -2, -1):
print(i)
What is the output when the user enters 6?
x = input("hi");
print(x/2)