Question

Find number list that is n%6 = 0 given list is integer 0 to n. You...

Find number list that is

n%6 = 0

given list is integer 0 to n.

You can only use three function. addOne(), isOdd(), isEven().

For example, if n = 13

input list is 1 2 3 4 5 6 7 8 9 10 11 12.

Output list is 6, 12.

It is easy with mod operator, but I cannot use it. We can only use addOne(), isOdd(), isEven().

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

Code:

def isOdd(list):
for n in list:
if n%3 ==0 :
isEven(n)
def isEven(n):

if n%2 == 0:
addOne(n)


def addOne(n):
a.append(n)
  
list =[ 1,2,3,4,5,6,7,8,9,10,11,12]
a=[ ]
isOdd(list)
print(a)

Add a comment
Know the answer?
Add Answer to:
Find number list that is n%6 = 0 given list is integer 0 to n. You...
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