Ask your own question, for FREE!
Computer Science 12 Online
kekeman:

Which of the following is not a reasonable explanation for the increase in cyber security jobs? Increased number of web-based college classes Increased frequency of online financial transactions Increased interest in computer science education Increased number of web-based businesses

kekeman:

I was thinking " Increased interest in computer science education"

kekeman:

Another question: You want to find all positive integers smaller than N that are divisible by 2 but not divisible by 3. For example, if N = 10, a program should print 2, 4, and 8. Since 6 is divisible by both 2 and 3, it is not in the list. The code below implements this algorithm. What is the missing line of code? def get_numbers(N): for n in range(1, N): if /**missing code**/: print(N) N % 2 = 0 and N % 3 != 0 N % 2 != 0 and N % 3 != 0 N % 2 == 0 and N % 3 == 1 N % 2 == 0 and N % 3 != 0

SmokeyBrown:

@kekeman wrote:
I was thinking " Increased interest in computer science education"
I think that makes sense. Increased interest in computer science education might be partly caused by an increase in jobs, but not the other way around.

SmokeyBrown:

@kekeman wrote:
Another question: You want to find all positive integers smaller than N that are divisible by 2 but not divisible by 3. For example, if N = 10, a program should print 2, 4, and 8. Since 6 is divisible by both 2 and 3, it is not in the list. The code below implements this algorithm. What is the missing line of code? def get_numbers(N): for n in range(1, N): if /**missing code**/: print(N) N % 2 = 0 and N % 3 != 0 N % 2 != 0 and N % 3 != 0 N % 2 == 0 and N % 3 == 1 N % 2 == 0 and N % 3 != 0
For the missing code, you want to find numbers that are divisible by 2 and not divisible by 3. In other words, the numbers, when divided by 2, should have a remainder equal to 0; and when divided by 3, they should have a remainder not equal to 0. Which of the options does that?

kekeman:

Hmmmm

SmokeyBrown:

Recall that the % operator gives the remainder of a division between two numbers. For example, 4%2 = 0 because 4/2 has a remainder of 0; 10%4 = 2 because 10/4 has a remainder of 2, etc.

kekeman:

N % 2 == 0 and N % 3 == 1?

SmokeyBrown:

That's close. You do want the remainder of N and 2 to be 0; but we want the remainder of N and 3 to be not 0

kekeman:

Hmmm interesting soo N % 2 == 0 and N % 3 != 0

SmokeyBrown:

Yup, that's right!

kekeman:

Ohhh because of the != sign Thank you for the help!!!

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!