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.41
5
4
3
2
1

Discussion

i = 0 x = 0 sum = 0 with open("data.txt","r") as file: for line in file: for char in line: if char == "0": i+=1 elif char == "1": x+=1 if i % 3 == 0 or x % 2 == 0: sum +=1 i = 0 x = 0 print(sum) ez sol

0

The correct answer is incorrect

-1

I made use of a simple Python Program to complete this challenge...makes it really quick in a file with that much lines lol

-3

6**2 answer nice one

-1

6**2 answer nice one

-1

I used Python, I opened the file in read mode and iterated through all the lines while increasing the count by 1 when either no. of 0s is divisible by 3 or no. of 1s is even.

0

I used C++

-1

I used C++

-1

Try once from yourself

hint - if unable to solve you can use online compiler - python for this and chatgpt to write code

-1
Protected
0
Protected
1

Actually I want to report a bug in the question. In the 10000 lines of 0 and 1, there are: 6660 lines being mixture of 0 and 1 (or only 0 and 1) that fulfill the condition, 3338 lines being mixture of 0 and 1 that DOES NOT fulfill the condition, and 2 lines being "0000000000" (that is 10 zeros). These 2 lines does not fulfill the condition but apparently have to be counted as part of the answer.

These 2 lines probably passed because they do not contain any 1, so if u count the number of ones and mod 0 it u get 0 which still pass in certain codes.

Hopefully this get patched by either removing those 2 lines or changing the answer to 6660 :)

14
Protected
1

line 537 & 6296

0

TRUEEE

0
Protected
4