Supermarket X68219


Statement
 

pdf   zip

html

Write a program that reads a sequence of expenses made by customers of a supermarket, and finds out whether anyone has paid in cash over 1000 euros.

Customer expenses are formatted in one line per customer. Each line consists of a sequence of floats (representing the prices of bought items) and ends with either the word card (if paid by credit card) or cash.

There is at least one customer line.

All customer lines include at least one item price.

The output must be either “Somebody paid over 1000 euros in cash!” if there is at least one customer line where the sum of all the prices of items bought adds to over 1000 and the line ends with the word cash; otherwise, the output must be “Nobody paid over 1000 euros in cash.

Input A sequence of customer expenses, in a separate line for each customer. Each line is a sequence of real numbers followed by either the word card or cash.

Output Either the sentence “Somebody paid over 1000 euros in cash!” or “Nobody paid over 1000 euros in cash.

Public test cases
  • Input

    10.30 3.55 22 card
    165.40 22.34 230.44 12.01 cash
    12.33 cash
    

    Output

    Nobody paid over 1000 euros in cash.
    
  • Input

    10.30 3.55 22 card
    165.40 22.34 230.44 12.01 444.02 389.01 card
    32.08 12.33 cash
    

    Output

    Nobody paid over 1000 euros in cash.
    
  • Input

    10.30 3.55 22 card
    165.40 22.34 230.44 12.01 444.02 389.01 cash
    32.08 12.33 cash
    

    Output

    Somebody paid over 1000 euros in cash!
    
  • Information
    Author
    ProAl
    Language
    English
    Official solutions
    Python
    User solutions
    Python