Answer to Question #297464 in Python for Ram

Question #297464

Math Quiz


Write a python program to print the following,


Sample Input 1

1 3 4 5 6

5

3 5

Sample Output1

12


1
Expert's answer
2022-02-13T18:47:00-0500
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()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS