Discussion 1: Getting Started with Jupyter Notebooks

โ† return to practice.dsc10.com


These problems are taken from past quizzes and exams. Work on them on paper, since the quizzes and exams you take in this course will also be on paper.

We encourage you to complete these problems during discussion section. Solutions will be made available after all discussion sections have concluded. You donโ€™t need to submit your answers anywhere.


Problem 1

Suppose we have imported the math module using import math. Consider the nested expression below:

int(math.sqrt(math.pow(4 * 2 ** 4, min(9 % 4, 9 / 4, 9 - 4))))


Problem 1.1

How many function calls are there in this expression? How many arguments does each function have?


Problem 1.2

What does this expression evaluate to?



Problem 2

After a trip to the zoo, Anthony wrote the following block of code.

zebra = 5
lion = 4
cow = 1
zebra = zebra * 2
lion = abs(cow - lion)
zebra = zebra + lion ** 2
cow = (zebra + lion) / 2 * lion

After running the above block of code, what is the value of cow?


๐Ÿ‘‹ Feedback: Find an error? Still confused? Have a suggestion? Let us know here.