I am trying to generate 5 unique random numbers and I have written a for loop for it:
for i in range(5):
print("enter a no")
x = int(input())
if x not in a:
a.append(x)
If x is not in a, only then i should be incremented. I can do this with while loop but want to know if we can do this with a for loop.
forloop should terminate after finitely many iterations.