Simple Programming
30 points Easy

Can you help me? I need to know how many lines there are where the number of 0's is a multiple of 3 or the numbers of 1s is a multiple of 2. Please! Here is the file: https://mega.nz/#!7aoVEKhK!BAohJ0tfnP7bISIkbADK3qe1yNEkzjHXLKoJoKmqLys

Flag
Rating 4.44
5
4
3
2
1

Discussion

Quiet Good Need basic Knowledge

0

Definitely good to practice the Python. Technically I guess you could use any language ? I'm not too well-versed on anything except Python yet.

0

Considering this is in the easy section.... where do I go to even begin learning to find the answer?

0

Not sure if you were making a joke, but if you are trying to learn how to get the answer, it's basically asking you to write a simple program, so you'd need to choose a programming language, and make sure that it's capable of going through the file that is up for download. I'd recommend looking into Python personally - it's a good language to start on, take it from me since I only started on it mid last year and I am writing some really cool stuff these days.

0
Protected
0

Don't forget that there could be empty lines

0
Protected
0
Protected
0

with open("zeros_and_ones.txt") as f: numbers = f.readlines()

counter = 0

for i in numbers: if (i.count("1") % 2 == 0) or (i.count("0") % 3 == 0): counter += 1

print(counter)

-11

WHY!? I don't think that the sense of the comments is to be a spoiler! Or did you simply forgot to protect this comment?

0

I read their comment and I still have no idea what's going on.

0