Crash-Course-on-Python-by-Google icon indicating copy to clipboard operation
Crash-Course-on-Python-by-Google copied to clipboard

error

Open dhruvabhat24 opened this issue 2 years ago • 1 comments

sir I have written same code but in the input part #Display your wordcloud image

myimage = calculate_frequencies(file_contents) plt.imshow(myimage, interpolation = 'nearest') plt.axis('off') plt.show() NameError Traceback (most recent call last) in 1 # Display your wordcloud image 2 ----> 3 myimage = calculate_frequencies(file_contents) 4 plt.imshow(myimage, interpolation = 'nearest') 5 plt.axis('off')

NameError: name 'file_contents' is not defined

Now what should I do

dhruvabhat24 avatar Feb 06 '23 02:02 dhruvabhat24

Hmmmm, according to this Sections of Code you don't have any variable named "file_contents". But you are using it as a File path. To rectify the problem, you should declare a variable named "file_contents" and initialize it the path of File.

On Mon, 6 Feb 2023, 7:25 am Dhruva Bhat, @.***> wrote:

sir I have written same code but in the input part #Display your wordcloud image

myimage = calculate_frequencies(file_contents) plt.imshow(myimage, interpolation = 'nearest') plt.axis('off') plt.show() NameError Traceback (most recent call last) in 1 # Display your wordcloud image 2 ----> 3 myimage = calculate_frequencies(file_contents) 4 plt.imshow(myimage, interpolation = 'nearest') 5 plt.axis('off')

NameError: name 'file_contents' is not defined

Now what should I do

— Reply to this email directly, view it on GitHub https://github.com/zaahidali/Crash-Course-on-Python-by-Google/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIGZ3CQU3X4V3T4KPEZFX3WWBOIZANCNFSM6AAAAAAUSEJFFY . You are receiving this because you are subscribed to this thread.Message ID: @.***>

RanaNomanAbbas avatar Feb 06 '23 07:02 RanaNomanAbbas