To gain experience with using lists and files.
For this lab, you will write a program that performs spell checking on words the user can enter in.
The way this will work is you will read in a file containing almost 100,000 English words and store them in a list. This wouldn't be feasible without a list variable! Once you have the list of all valid words, you can ask the user to enter words they wish to check. If their input is in the list, then it's spelt correctly. Otherwise, we tell them it's spelt wrong.
file = open("words.txt", "r")
This will create a very long string variable containing all of the words in the file.
data = file.read()
Below is an example run of how this program should work:
Enter a word: here Enter a word: are Enter a word: soem soem is spelled wrong Enter a word: words Enter a word: tetsing tetsing is spelled wrong Enter a word: this Enter a word: pogram pogram is spelled wrong Enter a word: quit
When you are finished, please submit the .py file for the lab on Canvas. To do so, you'll need to navigate to where you saved the file on your computer.
Copyright © 2022 Ian Finlayson | Licensed under a Attribution-NonCommercial 4.0 International License.