← return to practice.dsc10.com
Topics: Introduction.
Below are practice problems tagged for Lecture 1 (rendered directly from the original exam/quiz sources). By default, problems are sorted from easiest to hardest by average score; problems without a score are listed last.
You are tracking the growth of a flower stem over a seven-day period. The flower stem starts out at 24.5 cm and ends up at 29.7 cm.
Write one line of code that calculates the average daily growth, in
centimeters, and assigns the result to the variable
avg_growth. Do not round your answer.
Answer:
avg_growth = (29.7 - 24.5) / 7
The total growth is 29.7 - 24.5, which is 5.2 cm. To get
the growth per day, divide by the 7 days. The parentheses are needed
because division happens before subtraction. Without them, Python would
compute 29.7 - (24.5 / 7).
The average score on this problem was 84%.
The DataFrame clubs contains information about all the
student organizations at UCSD. For each club, we have its
"Name", "Category", number of
"Members", "Budget" in dollars,
"Rating" out of 5.0, and whether it is
"Active" represented by either True or
False. The first three rows of clubs are shown below.
Assume that all club names are unique.

The Cheese Club currently has 50 members. Each quarter, the number of people who will join the club is the value of the Python expression below.
3 * ((4 * 20 / 5 * 2 + 4) ** 0.5 - 2 ** 2)
How many members will the club have after 3 quarters?
56
68
74
82
None of these.
Answer: 68
Work from the innermost parentheses out, following order of operations:
4 * 20 / 5 * 2 runs left to right, since *
and / have equal precedence: 80 /
5 = 16, then 16 \cdot 2 =
32.32 + 4 = 3636 ** 0.5 = 6.0. Raising to the 0.5 power is a square
root.2 ** 2 = 4, so the parentheses give 6.0 - 4 = 2.0.3 * 2.0 = 6.0 new members per quarter.After 3 quarters:
50 + 3 \cdot 6 = 68
The average score on this problem was 65%.
What does the following expression evaluate to? Write your answer exactly how the output would appear in Python.
5 * (4 ** 3 - 40) / (2 * 8) ** .5 + 10 / 3 + 2 * (5 / 6 - 1 / 2)
🎥 A solution walkthrough video is available for this problem.
Answer: 34.0
The average score on this problem was 61%.