The assignment:
Write a program that will list at least 6 numbers for the customer. The program must process the received list and write down on each line whether the current number has been repeated before. If repeated, write "YES", if not - "NO". for example:
Step 1: The user enters at least 6 numbers that are stored in the array, say included [1, 2, 1, 1, 4, 2]
Step 2: The program will process the received list and display the answers on the following screen:
NO NO YES YES NO YES
My code:
x = []
y = []
for i in range (6):
i = int(input("Enter a number: "))
x.append(i)
for z in range(len(x)):
for j in range (z + 1,len(x)):
if x[z] == x[j]:
y.append("YES")
else:
y.append("NO")
if "YES" in y:
print("YES")
y.clear()
else:
print("NO")
y.clear()
i created y for just an experiment dont use it if you want to. all i want is to check if one element is the same as one of the other elements and if so give me only one YES not NO NO NO YES NO or something like that and if their are not the same just one NO