Question

write a python program Write a function is_factor(f, n) that passes these tests: test(is_factor(3, 12)) test(not...

write a python program

Write a function is_factor(f, n) that passes these tests:

test(is_factor(3, 12))

test(not is_factor(5, 12))

test(is_factor(7, 14))

test(not is_factor(7, 15))

test(is_factor(1, 15))

test(is_factor(15, 15))

test(not is_factor(25, 15))

An important role of unit tests is that they can also act as unambiguous “specifications”

of what is expected. These test cases answer the question Do we treat 1 and 15 as factors

of 15?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:-


def is_factor(f,n):
if n%f==0:
return "is_factor"
else:
return "is not a factor"


num=10
factor=3

is_factor(factor,num)

OUTPUT:-

cript.pyIPython Shell Out[1] is not a factor Run

Add a comment
Know the answer?
Add Answer to:
write a python program Write a function is_factor(f, n) that passes these tests: test(is_factor(3, 12)) test(not...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT