I used the command list.count, but it just doesn’t work.
Here’s the code:
import random
a = [random.randint (1, 10) for c in range (20) ]
print (a)
d = int (input ('Input a number') )
a.count(d)
while d in a:
list.remove (d)
print(a)
>Solution :
you have to remove d from a so you would do a.remove(d) and not list.remove(d)
list is an object of a class and not an instance of it, the list you are searching for is not list, but a:
import random
a = [random.randint (1, 10) for c in range (20) ]
print (a)
d = int (input ('Input a number') )
# a.count(d) #doesn't do anything
while d in a:
a.remove(d) #remove d from a
print(a)