Question
In Python, create a new Jupyter Notebook. Title the Notebook Math 272 Python Assignment 2. This is easily done by starting a cell in the
In Python, create a new Jupyter Notebook.
Title the Notebook Math 272 Python Assignment 2. This is easily done by
starting a cell in the rawNBConvert mode, typing a #, and then the title. Skip
a line and enter your name and the date. Next, change the mode to markdown
and then run the cell.
In this lab we wish to experiment with integer division and remainder (mod)
functions. In Python, integer divsion is implemented through //, and the mod
function by the percent operator, so that 11 mod 3 is written 11 % 3.
1.1 procedure
Begin by copying and running the following code (print statements will need to
be in separate cells to show):
import random
random.seed(my_coyote_id)
a = random.randint(3,10)
b = random.randint(3,10)
print(a)
print(b)
1. Find 23 / 11
2. Find q = 23 // 11 and r = 23 % 11
3. Verify 23 = 11*q+r
4. Find q = -23 // 11 and r = -23 % 11
5. Verify -23 = 11*q+r
6. Find q = 23 // b and r = 23 % b with b from above.
7. Verify 23 = b*q+r
8. Try the list comprehension [ n % 7 for n in range(360, 367)]
9. Try [(4*n +4*n**2 +1) % 8 for n in range(30)].
10. What is 365 %7? In 2018, October 25 is a Thursday. What day of the
week will it be next year (October 25 2019, in 365 days)? What day of
the week will October 25, 2028 be? (dont forget leap years!).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started