Edhesive 3.1 - 3.5 Questions & Answers
3.1 Lesson Practice
A ____________ is a set of commands which can be run by calling it by name. - ✔✔function
3.1 Lesson Practice
A _____________ is a piece of information sent t
...
Edhesive 3.1 - 3.5 Questions & Answers
3.1 Lesson Practice
A ____________ is a set of commands which can be run by calling it by name. - ✔✔function
3.1 Lesson Practice
A _____________ is a piece of information sent to a function. - ✔✔parameter
3.1 Lesson Practice
Consider the following code:
x = random.randint (1, 100)
The randint is a ____________. - ✔✔function
3.1 Lesson Practice
Which of the following is NOT a function? - ✔✔math
3.2 Lesson Practice
For questions 1-3, consider the following code:
What is output if the user types in 9? Click all that apply. - ✔✔C
D
A
3.2 Lesson Practice
What is output if the user types in 8? Click all that apply. - ✔✔C
3.2 Lesson Practice
What is output if the user types in 13? Click all that apply. - ✔✔A
D
B
3.2 Lesson Practice
The following code is intended to test if x is NOT less than 17. Fill in the correct symbol:
if (x ____ 17): - ✔✔>=
3.2 Code Practice: Question 1 - ✔✔n = float(input("Enter a number: "))
if (n>45.6):
print("Greater than 45.6")
if(n<45.6):
print("Less than 45.6")
3.2 Code Practice: Question 2 - ✔✔a = float(input('Enter a number: ')) i
f(a >= 90):
print('Great!')
3.2 Code Practice: Question 3 - ✔✔password = input("Enter the password:")
if(password=="Ada Lovelace"):
print("Correct!")
if(password!="Ada Lovelace"):
print("Not Correct!")
3.3 Lesson Practice
Consider the following code:
if (x > 5 AND x <= 10): print(OK)
Click all the mistakes that apply: - ✔✔The print (OK) should be print ("OK")
AND should be and
3.3 Lesson Practice
The blue section of the following Venn diagram could represent which of the following Boolean
statements? - ✔✔not
3.3 Lesson Practice
The following code will not compile. Which of the options below would allow the code to
compile and run as intended?
if (x >= -10 and <= 10): print("In range") - ✔✔if (x >= -10 and x <= 10):
3.3 Code Practice: Question 1 - ✔✔day = int(input("Enter today's day numerically: "))
if(day == 15 or day == 30):
print("It's payday!")
if(day != 15 and day != 30):
print("Sorry, not a payday.")
3.3 Code Practice: Question 2 - ✔✔r = int(input("Enter the red: "))
g = int(input("Enter the green: "))
b = int(input("Enter the blue: "))
if(r <= 0 or r >= 255):
print("Red number is not correct.")
if(g <= 0 or g >= 255):
print("Green number is not correct.")
if(b <= 0 or b >= 255):
print("Blue number is not correct.")
3.4 Lesson Practice
What is the output?
x = 9 % 2
if (x == 1):
print ("ONE")
else:
print ("TWO") - ✔✔ONE
3.4 Lesson Practice
For questions 2-4, consider the following code:
What is the output if month = 9 and day = 14? - ✔✔First half of the month
3.4 Lesson Practice
What is output if month = 11 and day = 14? - ✔✔Not in September
3.4 Lesson Practice
What is output if month = 9 and day = 21? - ✔✔Second half of the month
3.4 Code Practice: Question 1 - ✔✔color =
[Show More]