Question: Python Write a program that reads a sequence of numbers ended by 0 and print all the numbers that repeat at least twice. Sample Input

Python

Write a program that reads a sequence of numbers ended by 0 and print all the numbers that repeat at least twice.

Sample Input

3 4 3 7 2 2 1 3 0 

Sample Output

3 2 

lst = [] cns = [] while True: ----n = int(input()) ----if n != 0: -------lst.append(n) ----elif n == 0: -------lst.append(n) -------break for i in lst: ----x = lst.count(i) ----if x >= 2: -------if x not in cns: ----------cns.append(x) for i in cns: ----print(i,end=' ')

this is what i did, but it give me a EOFError : EOF when reading the line 14 : " n = int(input())"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!