What does the following function do? def fun(n): d2 = set() for i in range(1,…
PYQ Capgemini Hiring Assessment 2025
What does the following function do?
def fun(n):
d2 = set()
for i in range(1, int(sqrt(n) + 1)):
if n % i == 0:
d2.add(i)
d2.add(n // i)
return list(d2)- A.
Finds the prime numbers upto n
- B.
Finds remainders when divided by n
- C.
Finds all divisors of a number
- D.
Finds the GCD of a number
Attempted by 171 students.
Sign up free to check your answer
Sign up freeLoading lesson…

