New answers tagged

3

if word in matching_words: matching_words[word] += 1 else: matching_words[word] = 1 If you're checking if a dictionary has a key before adding to it, a defaultdict may be a better option: from collections import defaultdict matching_words = defaultdict(int) matching_words[word] += 1 int returns a 0 when called without arguments, and that 0 is used ...


4

Break up logic into functions Having separate functions for each of the following steps will make the code easier to read. Get game names Scrape game information Display game information Guard your script's entry point I'd recommend moving the script execution flow under an if __name__ == "__main__": guard. Doing this allows you to import the ...


Top 50 recent answers are included