• 1
    Input and Output Data
    • Tasks
  • 2
    Conditions
    • Tasks
  • 3
    For Loop
    • Tasks
  • 4
    Strings
    • Tasks
  • 5
    While Loop
    • Tasks
  • 6
    Lists
    • Tasks
  • 7
    Two-Dimensional Arrays
    • Tasks
  • 8
    Dictionaries
    • Tasks
  • 9
    Sets
    • Tasks
  • 10
    Functions and Recursion
    • Tasks
  • к

Занятие 8. Dictionary

Difficulty level:

Task«Insurance company»

The insurance company has a database of customers, each of which has a unique identifier, name, age, gender, type of insurance and insurance coating. Write the program on Python, which analyzes these data and displays the following report:
rn
    rn
  1. Rn
    The name of young client.
    rn
  2. rn
  3. rn
    the name of the most elderly client.
    rn
  4. rn
  5. Rn
    Rn
    rn
  6. rn
  7. Rn
    the type of insurance that is chosen more often Total. RN
  8. rn
  9. rn
    rn
  10. rn

    Input format

    The program receives a list of dictionaries where each dictionary presents information about one client. Dictionary structure:
    rn
    {
    & nbsp; & nbsp; "ID": int, & nbsp;# Unique client identifier
    & nbsp; & nbsp; "Name": str, # client name
    & nbsp; & nbsp; "Age": int, & nbsp;# the age of the client
    & nbsp; & nbsp; "Gender": str, # the client of the client ("m" - male, "g" - female)
    & nbsp; & nbsp; "Insurance_type": str, # insurance type (for example, "ok", "pd", "casco")
    & nbsp; & nbsp; "Coverage_amount": int # Support of insurance coating
    }
    rn
    data "> data"> data "> data"> They are introduced through the console line, first the number of customers is indicated, and then the information on each client in the python dictionary format
    rn
    rn
     & nbsp;  rn 
     & nbsp;  rn 

    Output format

    The program should display the report in the following format:
    rn
    The youngest client: [name]
    the oldest client: [name]
    average age of customers: [average age]
    number of male customers: [quantity]
    number of women's customers: [quantity]
    the type of insurance, [type of insurance]
    the total amount Insurance coating: [sum]

    Example

    Input

    3
    {"Id": 1, "name": "Ivan", "Age": 25, "Gender": "M", "Insurance_type": "OK", "Coverage_AMUNT": 100000}
    {"ID": "NAME": "Maria", "Age": "Age": "Age": "Age": "Age": "Age": "Age": "Age": "Age": "Age": "Age": "Age" 30, “Gender”: “F”, “Insurance_type”: “PD”, “Coverage_AMOUNT”: 200,000}
    {“ID”: 3, “NAME”: “Alexey”, “Age”: 45, “Gender”: “M”, “InSURANCE_TYPE”: “OK”, “OK”, “OK”, “OK”, “OK”, “OK”, “OK”, “OK”, “OK” "Coverage_amount": 150,000}

    Output

    The youngest client: Ivan
    The most elderly client: Alexey
    The average age of customers: 33.33
    Number of male customers: 2
    The number of women's customers: 1
    type of insurance that is most often selected: OK
    The total insurance coating amount: 450000

    Hint

    There will be no clue here, decide for yourself!

main.py
Test 1
Test 2
Test 3
Test 4
Test 5
Test 6
Test 7
Test 8
Test 9
Test 10
Developer’s solution

🎉 Congratulations! 🎉

You did an excellent job with the task! It was a challenging problem, but you found the correct solution. You are one step closer to mastering programming! Keep up the good work, because every stage you pass makes you even stronger.

AD

Advertisement

red-snake blue-snake green-snake

Running your code...

Помощник ИИ

Привет! Я твой помощник по программированию. Задавай любые вопросы по Python, я могу рассказать о функциях, методах, обьяснить то, что тебе не понятно, а так же о текущей задаче!