This is an assignment so I'd like to get informative hints rather than code to copy.
We are supposed to make a program that automaticaly completes words. (Gives out suggestions based on letters written.)
The suggestions for these words are taken from a list called "alphabetical.csv", which is a separate data file, containing around 90000 different words.
I've been thinking of making lists to be printed out to the user, suggesting all words beginning with a certain letter, and possibly the next, and the next, and so on, but I've no idea of how to implement that effectively.
There is a skeleton which must be used with the assigment which looks like this:
def main():
"""Initialize main loop."""
word = ""
while word != "q":
word = input("Type word: ").lower()
print("Autocompletion finished: ", autocomplete())
def autocomplete():
"""Return autocomplete suggestions."""
pass
main()
We are not supposed to import anything, and the program itself is supposed to run in a terminal.