Math Quiz
Write a python program to print the following,
Sample Input 1
1 3 4 5 6
5
3 5
Sample Output1
12
numbers = input().split(' ')
def checkNums(nums):
status = True
for num in numbers:
if num.isdigit():
continue
else:
status = False
break
return status
def errorMessage():
print('Error! must only be entered numbers separated by a space')
if checkNums(numbers):
removeNums = input().split(' ')
if (checkNums(removeNums)):
for num in removeNums:
if num in numbers:
numbers.remove(num)
for num in numbers:
print(num, end=' ')
else:
errorMessage()
else:
errorMessage()
Comments
Leave a comment