• 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«Gifts by mail»

You work in the site support service. You need to create a guide containing information about the user postal indices to send congratulatory cards to them. You have a list containing user data. Each user is presented in the form of a list, where the first element & ndash; This is the user name (line), and the second element (if any) & ndash; Its postal index (line). Not all users have a postal index. rn
write a program that accepts this list and forms a dictionary in which users are the keys, and values ​​& ndash; Their postal indices. If the user does not have a postal index, then the value should be & nbsp; none .

Input format

Two-dimensional list where each internal list contains information about one user. Each internal list contains the user's name (line) and, optionally, the postal index (line)

Output format

constructive output in the user name: "Postal Code", where "Postal Index" can be a line or "none"

Example

Input

[["Ivan", "123456"], ["Maria"], ["Peter", "654321"], ["Anna", "987654"], ["Svetlana"]]

Output

Ivan: 123456
Maria: None
Peter: 654321
Anna: 987654
Svetlana: None

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, я могу рассказать о функциях, методах, обьяснить то, что тебе не понятно, а так же о текущей задаче!