#A program to accept user inputs and stores them without duplicate values in python.
mySet = set()
#number of values allowed to be stored in the set
n = 5
while len(mySet) < n :
foo = float(input("Enter value:"))
foo = round(foo)
mySet.add(foo)
#print the unsorted set
print(mySet)
mySet = set()
#number of values allowed to be stored in the set
n = 5
while len(mySet) < n :
foo = float(input("Enter value:"))
foo = round(foo)
mySet.add(foo)
#print the unsorted set
print(mySet)
No comments:
Post a Comment