What is an integer?
A whole number
What is a for loop?
In computer science, a for-loop (or simply for loop) is a control flow statement for specifying iteration, which allows code to be executed repeatedly.
What is a String variable?
String variables may contain letters, numbers and other characters.
What is a computer?
Any machine that can carry out a set of algorithms and arithmetic instructions.
What is a function?
In programming, a named section of a program that performs a specific task. In this sense, a function is a type of procedure or routine.
What is the difference between a Double and an Integer?
A double can be a decimal number, while integers have to be whole numbers.
What is a While loop?
A while loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition. The while loop can be thought of as a repeating if statement.
fruits = ["apples", "grapes", "banana"]
what does print(fruits[1]) print out?
It prints out grapes.
What is the motherboard in a Pitop called?
A Raspberry Pi!
How do you declare a function?
Use the words def!
Name and explain all four types of variables that we learned about in class.
Boolean, string, integer, double.
What does the following Code do?
For i in range(0,10):
print("Hello Monkeys")
prints Hello Monkeys 10 times
How do you get the last item in a list?
pop()
What does the following function do?
def sayHi(name):
print("Hi" + name)
prints Hi and whatever name is inputed.
What is wrong with the following code?
print("hi I am" years + "old")
forgot a + sign.
What does the following code do?
keep_going = True
while keep_going:
walkTowardsDragon()
walks towards the dragon infinitely until met with ultimate death.
What is wrong with the following code?
guessed = True
while not guessed:
guess = input("Pick a number")
if int(guess) == 14:
guessed = True
print("You win!")
The while loop never executes because it is initially set to True.