Finish this sentence "Project report section titles should be ..."
What is the difference between 12/3
and 12//3
?
What is wrong with the following scenario. " Student A is working on project 1. Their roommate took 337 last semester, so Student A asked for help with the project. Their roommate showed Student A their project report and explained the code. Student A then wrote their own project report and turned it in (without copying their roommate's code)."
Identify and correct the error.
x=37
if x%2 == 1
print("It is odd")
Project report section titles should be short and descriptive.
12/3
results in the float 4.0
while 12//3
results in the integer 4
.
Student A was getting outside help with the project.
Missing colon at the end of line 2.
x = 51
q = 0
while x >= 3:
x -= 3 # This is the same as x = x-3
q += 1
print(x)
print(q)
16*3
56//3
x = [2,3,5,7,11,13]
for i in x:
print(i)
for i in range(len(x)):
print(x[i])
def IsPrime(num):
is_prime = True
for div in range(2,num):
if num%div == 0:
is_prime = False
break
return is_prime
IsPrime(7)
def IsPrime(num):
for div in range(2,num**0.5 +1):
if num%div == 0:
return False
return True
import math
math.sqrt(5)
math.sin(math.pi)
import numpy as np
np.linspace(1,10)
from math import cos
cos(0)
def IsPrime(num): # define function IsPrime with integer input num
for div in range(2,int(math.sqrt(num)) +1): # loop through possible divisors of num, up to the square root
if num%div == 0: # check if the loop variable is a divisor
return False # if it is, then num is not prime and False is returned
return True # if we get through the loop, then no divisors and num is prime
IsPrime(5682437)
$ m \equiv n (\mod k) $