Advertisement
Nenogzar

Untitled

Feb 6th, 2024
797
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. """ 1 nested list"""
  2. num_list = list()
  3. export_list = list()
  4. while True:
  5.     to_do_list = input()
  6.     if to_do_list == "End":
  7.         break
  8.  
  9.     tasks = to_do_list.split("-")
  10.     nested_list = [task.strip() for task in tasks]
  11.     num_list.append(nested_list)
  12.  
  13. num_list.sort(key=lambda x: x[0])
  14.  
  15. # print(num_list)
  16.  
  17. for nested_list in num_list:
  18.     export_list.append(nested_list[1])
  19. print(export_list)
  20.  
  21. """ 2  tuple """
  22.  
  23. to_do_list = input()
  24.  
  25. num_list = list()
  26.  
  27. while to_do_list != "End":
  28.     importance, note = map(str.strip, to_do_list.split("-"))
  29.     num_list.append((int(importance), note))
  30.  
  31.     to_do_list = input()
  32.  
  33. num_list.sort(key=lambda x: x[0])
  34.  
  35.  
  36. export_list = [note for _, note in num_list]
  37. print(export_list)
Tags: To-Do
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement