Looking for CITS1401 Computational Thinking with Python (2025S1) test answers and solutions? Browse our comprehensive collection of verified answers for CITS1401 Computational Thinking with Python (2025S1) at quiz.jinhong.org.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Which of the following are true?
If you want to learn anything from this question you should first try to use the documentation and/or the dir and help function to predict how the various methods will behave. You can then check your predictions by typing the expressions into the shell.
Important Note: It would be a good idea to spend a bit of time trying to understand what string methods are available, as you will need them repeatedly throughout the rest of this course. Sometimes, knowing about the existence of particular methods can save you hours of wasted effort trying to re-invent the wheel!
A block of code is given below. Which of the subsequent code blocks are equivalent? Select ALL answer(s), and try to solve without checking your answer. You can assume all variables have already been declared as integers, and they are all unique numbers (i.e., no two variables will have the same value).
if (a > b) and (b < c):
if a > c:
print("largest is a")
else:
print("largest is c")
elif a < b:
if c < b:
print("largest is b")
else:
print("largest is c")
else:
print("largest is a")
What is printed after executing the code below? Try to answer the question without trying it out!
a = 10b = 15if a > b: a += belse: a += b * 2if a < b: print("awesome!")elif a > 20: print("great!")else: print("nice!")
Which of the following are syntactically INCORRECT (ie their syntax is INCORRECT for the Python programming language)? Select ALL answers. You may assume all variables have previously been declared.
var1 != var2Statement 2:not var1 == var2Functions should also have clear and concise naming, so that users (such as yourself and your colleagues) will be able to understand what it does without having to go over the function in detail. Of course, they should also be syntactically correct. Select ALL functions names that are syntactically correct AND are of good style (i.e. readability).
Look at the Python expressions below. What is the value of 'orange' when all those expressions are executed in that order?
You are welcome to use Python to check your answer, but try to solve it without using Python first.
apple = 15pineapple = apple * 2 + 1orange = apple + pineappleorange = orange - (apple * 2)Which of the following are syntactically correct Python assignment statements? Here, you can assume all the variables are already defined. Select ALL that are correct.