def round_to_two_places(num): """Return the given number rounded to two decimal places. >>> round_to_two_places(3.14159) 3.14 """ # Replace this body with your own code. HINT: Python has a builtin function round. # ("pass" is a keyword that does literally nothing. We used it as a placeholder # because after we begin a code block, Python requires at least one line of code) pass def to_smash(total_candies): """Return the number of leftover candies that must be smashed after distributing the given number of candies evenly between 3 friends. >>> to_smash(91) 1 """ # put your code here pass def to_smash(total_candies, total_num_friends): """Return the number of leftover candies that must be smashed after distributing the given number of candies evenly between total_num_friends friends. >>> to_smash(91,3) 1 """ # put your code here pass """ 1. Read the following code and predict what you think will happen when it's run. 2. Then uncomment the code and run it to see what happens. (**Tip**: In the kernel editor, you can highlight several lines and press `ctrl`+`/` to toggle commenting.) 3. Fix the code (so that it accomplishes its intended purpose without throwing an exception) """ # ruound_to_two_places(9.9999) # x = -10 # y = 5 # # Which of the two variables above has the smallest absolute value? # smallest_abs = min(abs(x, y)) # def f(x): # y = abs(x) # return y # print(f(5)) """ For this question, we'll be using two functions imported from Python's `time` module.The [time](https://docs.python.org/3/library/time.html#time.time) function returns the number of seconds that have passed since the Epoch (aka [Unix time](https://en.wikipedia.org/wiki/Unix_time)). Try it out below, each time you should get a slightly large number. The sleep function will make us wait for some number of seconds. """ # Importing the function 'time' from the module of the same name. # (We'll discuss imports in more depth later) from time import time t = time() print(t, "seconds since the Epoch") from time import sleep duration = 5 print("Getting sleepy. See you in", duration, "seconds") sleep(duration) print("I'm back. What did I miss?") """ With the help of previous function, complete the function `time_call` below according to its docstring. """ def time_call(fn, arg): """ Return the amount of time the given function takes (in seconds) when called with the given argument. """ # add your code here pass """ Complete the function below according to its docstring. """ def slowest_call(fn, arg1, arg2, arg3): """ Return the amount of time taken by the slowest of the following function calls: fn(arg1), fn(arg2), fn(arg3) """ # add your code here pass """ Read the function definition below. What do you think will be returned by the function call at the bottom of the cell? Will it match the docstring example? Return something else? Or will Python raise an exception? When you're ready, run the code cell to find out. """ def smallest_stringy_number(s1, s2, s3): """Return whichever of the three string arguments represents the smallest number. >>> smallest_stringy_number('1', '2', '3') '1' """ return min(s1, s2, s3) smallest_stringy_number('1', '2', '3')