0% found this document useful (0 votes)
8 views1 page

1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

the first task :

def calculate_remainder(negative_number, positive_number):


remainder = negative_number % positive_number
return remainder

# Example usage
negative_num = -10
positive_num = 3

remainder = calculate_remainder(negative_num, positive_num)


print(f"The remainder of {negative_num} divided by {positive_num} is {remainder}.")

the second task :

import math

def calculate_divisors(n):
divisors = []
# Calculate the square root of n
root = int(math.sqrt(n))

for i in range(1, root + 1):


if n % i == 0: # Check if i is a divisor
divisors.append(i)
if i != n // i: # Add the corresponding divisor
divisors.append(n // i)

divisors.sort() # Sort the list of divisors


return divisors

# Example usage
number = 36
divisors = calculate_divisors(number)
print(f"The divisors of {number} are: {divisors}")

You might also like