Answer to Question #297466 in Python for Ram

Question #297466

Purchase List

At a shop, a shopkeeper is making a note of all the purchases at the end of the day.He has a list full of the purchases that happened at the shop.He wants to know which item got sold only once and which item got sold more than once.Print their prices as asked.


Note:In case of ties, choose the price of the item that was sold earlier in the day.


Input

The input is a single line containing space-separated integers representing the prices of the purchases.


Output

The first line of the output contains an integer that represents the price of an item that is sold only once.

The second line of the output contains an integer that represents the price of an item that is sold more than once.


If there is no filling the given criteria, print None.



Sample Input1

5 5 4 7 4 1 11

Sample Output1

7

5


Sample Input2

1 2 3 4 5 6 7 8 9

Sample Output2

1

None


1
Expert's answer
2022-02-13T18:47:32-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):
    maxNum = max(numbers, key=numbers.count)
    minNum = min(numbers, key=numbers.count)
    if maxNum == minNum:
        maxNum = 'None'
    print(minNum)
    print(maxNum)
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