Weekly Quizzes well answered to
pass(7)
Which Python function can only provide output to the user? - correct answer ✔✔print()
In the following line of Python code, what is the argument to the input function?
user_status = input("How are you today?") - correct answer ✔✔"How are you today?"
Which of the following items is a string? - correct answer ✔✔"E1E10"
In Python, you cannot perform mathematical calculations with variables of type float. - correct answer
✔✔False
Which of the following would display the number 9 as output? - correct answer ✔✔print(round(9.2))
Which of the following Python operators finds the remainder in a division? - correct answer ✔✔%
In order to use certain math functions such as trunc(), one must: - correct answer ✔✔Import the
functions from the math library
What is the difference between simple interest and compound interest? - correct answer ✔✔Compound
interest earns interest on interest received in previous periods, while simple interest does not
What is displayed with the following code is run?
my_balance = 100
, my_balance += 2 * 3 + 1
print (my_balance) - correct answer ✔✔107
In the future value formula:
F = I(1 + r)t
the variable I represents: - correct answer ✔✔The initial investment
When doing math in Python, it is helpful to use parentheses to - correct answer ✔✔eliminate ambiguity
Which of the following statements would raise the value of variable my_num to the power of 2? - correct
answer ✔✔1) my_num = my_num * my_num
2) my_num *= my_num
3) my_num = my_num**2
What is displayed when the following code is run?
a_dog = "fido"
two_dogs = a_dog + 1
print (two_dogs) - correct answer ✔✔Nothing, the code contains an error
The following code is intended to add one to the user's current age and then display it. What is the error
in the code?
current_age = input("Please enter your current age:")
current_age = current_age + 1
print("Your age next year will be " + str(current_age)) - correct answer ✔✔You must convert current_age
to a number before adding 1 to it