Jun-17-2021, 05:12 AM
I was hoping I could display the output window for a few seconds then close it automatically, but that's not happening.
What am I doing wrong?
What am I doing wrong?
def countLetters(code): alphabet = "abcdefghijklmnopqrstuvwxyz" letter_counts = [code.count(l) for l in alphabet] letter_colors = plt.cm.hsv([0.8*i/max(letter_counts) for i in letter_counts]) plt.bar(range(26), letter_counts, color=letter_colors) plt.xticks(range(26), alphabet) # letter labels on x-axis plt.tick_params(axis="x", bottom=False) # no ticks, only labels on x-axis plt.title("Frequency of each letter") plt.show() # added by me time.sleep(6) plt.close()