Question
Read and sort words Instructions Create a Python program that does the following: - Opens the file attached to this assignment: https://www.dropbox.com/scl/fi/kcgvam3ljbv2at0ci110k/LoremIpsum.txt?rlkey=3fb0i23p74a9ci2dd55fqf9t4&dl=0 - Reads
Read and sort words
Instructions
Create a Python program that does the following:
- Opens the file attached to this assignment: https://www.dropbox.com/scl/fi/kcgvam3ljbv2at0ci110k/LoremIpsum.txt?rlkey=3fb0i23p74a9ci2dd55fqf9t4&dl=0
- Reads the contents of the file into a String variable.
- Using the String.split() function, split the contents of the String variable into individual words, as entries in a List. So each item of the new List will be a word from the file.
- Create another separate list that contains only the unique words with no duplicates.
- OUTPUT: the list from the lest step above, sorted alphabetically. HINT: use the String.sort() function.
Additional info on String functions (goes to W3schools website) https://www.w3schools.com/python/python_ref_list.asp
What to submit: Your python (.py) code file.
Step by Step Solution
3.31 Rating (175 Votes )
There are 3 Steps involved in it
Step: 1
Below is the Python code Import necessary libraries import urllibrequest Define the URL of the file ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started