Write a program that repeatedly asks from users some numbers until string ‘done’ is typed. Program should accept only unique numbers that is once a number is entered, it cannot be re-entered. The program should print the sum of all numbers entered.

Code

 x=[] n=input('Enter a number: ') while n!='done': if int(n) not in x: x.append(int(n)) n=input('Enter a number: ') else: print('Number Repeated, Aborting program') break print(sum(x))    

Leave a Comment

Your email address will not be published. Required fields are marked *