This is my final project for the python crash course, why does it say " name 'file_contents' is not defined" , its keeps showing me that error, can someone help me and tell me what i'm doing wrong | Coursera Community
Coursera Header
Question

This is my final project for the python crash course, why does it say " name 'file_contents' is not defined" , its keeps showing me that error, can someone help me and tell me what i'm doing wrong

  • 15 October 2020
  • 1 reply
  • 76 views

Badge +1

 


1 reply

Userlevel 2
Badge +5

Hello.

I have not taken this course. But from my basic understanding of Python, you’re calling the function calculate_frequencies() passing a variable named file_contents as its argument. What type of variable is this? Use of lower(), split() and isalpha() methods in function definition suggest it should be a string type variable. Was it defined / assigned any value earlier? Was any text file opened ant its contents read into the variable?

Reply