2 is an example of this data type.
What is integer?
What is a loop in programming?
A loop is a structure that repeats a section of code.
Why is it important to name variables with descriptive names?
Helps us understand what the program is doing... less bugs..
return
What is Mr. S's favorite hockey team?
New York Rangers
3.2 is an example of this data type.
What is a float?
What are the two types of loops?
For and while loops
A value or "box" that stores information.
How do you correctly call the following function? :
def square(x) :
a = pow(x,2)
return a
x = square(5)
How many tattoos does Mr.S have?
8 tattoos.
"5" is an example of this data type.
What is a string?
How many times does this loop run?
for x in range(5):
t.circle(40)
t.forward(20)
5 times.
Write an example of a variable in Python syntax.
color = red
The words in front of the parentheses are function names, and the comma-separated values inside the parentheses are function _____
arguments
What is the "NPC" abbreviation short for to a video gamer?
Non-Playable Character
True is an example of this data type.
What is a Boolean?
What is the difference between while and for loops?
Ask a user for their age, with a variable to store that information.
age = int(input("how old are you?")
If Matt buys five hamburgers and spends $5.50, how much will it cost Matt to purchase twenty hamburgers for the bbq? Use functions, and the string below to complete your calculations.
burgers = "5.50"
burgers = "5.50"
burgers = int(burgers)
burgers = burgers/5
def calculatebbq (price):
twenty = price*20
return twenty
print(calculatebbq(burgers))
How do you calculate the atomic mass of an element?
Add the protons and neutrons.
1 or 0 is an example of...(3 answers)
Integer / Boolean / Binary
Write an algorithm that draws a star using a for loop.
for line in range(5):
t.forward(30)
t.right(144)
What is it called when we use "int" when asking a user for a number alongside a string?
This is called casting. It changes the string to an integer automatically.
Write a python code that uses input and a function to greet a user.
def greeting(name):
print("Hello"+name)
username = input("Enter your name:")
print(greeting(username))
Which planet is the hottest in our solar system?
Venus