Challenge: Document Organizer
When you want to automate the organization of legal documents in Python, you can start by using a hardcoded list of document names and their types. This means you define the data directly in your script, rather than reading it from a user or a file. To organize this data, you will build a dictionary where each key is a document type (such as contract or memo) and the value is a list of file names belonging to that type. After constructing this dictionary, you can display the results by printing the dictionary to the console. This approach helps you quickly see how your documents are grouped by type and can serve as a foundation for more advanced automation tasks.
Swipe to start coding
Write a script that organizes a hardcoded list of legal document names by their type and prints the resulting dictionary.
- Use the provided
documentslist, where each element is a tuple containing a document name and its type. - Build a dictionary where each key is a document type and the value is a list of document names with that type.
- Return the organized dictionary from the function.
Lösning
Tack för dina kommentarer!
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Can you show me an example of how to create this dictionary in Python?
How can I add more document types or files to the list?
What are some next steps to automate this process further?
Fantastiskt!
Completion betyg förbättrat till 4.76
Challenge: Document Organizer
Svep för att visa menyn
When you want to automate the organization of legal documents in Python, you can start by using a hardcoded list of document names and their types. This means you define the data directly in your script, rather than reading it from a user or a file. To organize this data, you will build a dictionary where each key is a document type (such as contract or memo) and the value is a list of file names belonging to that type. After constructing this dictionary, you can display the results by printing the dictionary to the console. This approach helps you quickly see how your documents are grouped by type and can serve as a foundation for more advanced automation tasks.
Swipe to start coding
Write a script that organizes a hardcoded list of legal document names by their type and prints the resulting dictionary.
- Use the provided
documentslist, where each element is a tuple containing a document name and its type. - Build a dictionary where each key is a document type and the value is a list of document names with that type.
- Return the organized dictionary from the function.
Lösning
Tack för dina kommentarer!
single