I'm making a program whereby the user has two enter 10 integers:
a = input('Enter an integer: ')
b = input('Enter an integer: ')
c = input('Enter an integer: ')
d = input('Enter an integer: ')
e = input('Enter an integer: ')
f = input('Enter an integer: ')
g = input('Enter an integer: ')
h = input('Enter an integer: ')
i = input('Enter an integer: ')
j = input('Enter an integer: ')
I would like to know how to reject a number which has already been entered already and then prompt the user to enter another value
Store your numbers in a collection, such as a list. Then you can check if new numbers are already in the collection before adding more.
If you don't care about the order of the integers, you can use a
set
, which imposes uniqueness automatically.