Шукаєте відповіді та рішення тестів для 24-25 CS1821/CS1822/DC1821: Programming Laboratory? Перегляньте нашу велику колекцію перевірених відповідей для 24-25 CS1821/CS1822/DC1821: Programming Laboratory в moodle.royalholloway.ac.uk.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
To complete the checkpoint you need to discuss your solution with a teaching assistant during the checkpoint sessions. Use the box below to make any notes that will be useful.
To complete the checkpoint you need to discuss your solution with a teaching assistant during the checkpoint sessions. Use the box below to make any notes that will be useful.
Match the following expressions with their values.
Which of the following programs is the shortest that is also equivalent to the following code?
if i % 4 == 0:
x = 0
elif i % 4 == 1:
x = 1
elif i % 4 == 2:
x = 2
else:
x = 3
What values could the expression i % 4 evaluate to?
To complete the checkpoint you need to discuss your solutions with a teaching assistant during the checkpoint sessions. Use the box below to record any notes that might be useful.
What is the difference between the two population sizes after 50 years?
The checkpoint sheet is not complete until it has been marked by a TA. During your checkpoint marking meetings, a TA will discuss your work with you and ask some simple questions. If you show a good understanding of the code you have written, they will mark this question (and therefore the sheet) as passed.You do not need to write anything in the box below, but may use it for notes if you wish.
We can compare the value of two numerical expressions to obtain a boolean value. Comparison operators that you might use include == (checking equality), != (checking for disequality), > (greater than), and < (less than).
What do think the value of the following expressions are?
You can check the answers by extending your program in expressions.py to print out the values of these expressions.
The boolean constants in Python are True and False, and the operators for combining boolean expressions are and, or, and not. If <<expr1>> and <<expr2>> are two boolean expressions, then:
<<expr1>> and <<expr2>> evaluates to true exactly when both <<expr1>> and <<expr2>> evaluate to true, and evaluates to false otherwise;<<expr1>> or <<expr2>> evaluates to true when at least one of <<expr1>> and <<expr2>> evaluate to true, and evaluates to false otherwise; andnot <<expr1>> evaluates to true exactly when <<expr1>> evaluates to false, and vice-versa.What do you think the order of precedence is between and, or and not? You can check the answers by extending your program in expressions.py to print out the result of evaluating the following boolean expressions.