Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

3. Identify and describe nine cultural value orientations.

Answered: 1 week ago

Question

4. Describe how cultural values influence communication.

Answered: 1 week ago