Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started