• Power Shell Help


Hello all I know this isn't necessarily a Checkio related question but I like the Checkio community and figured this would be a good place to ask. Now, the issue I'm having is not really understanding how programs are executed irl. I went through Codecademy and will be spending more time in Checkio now polishing my skills, but when it comes to writing my own programs and actually using them I'm kind of at a loss. I've "written" two programs as test subjects to experiment with using the powershell with. The first is a simple text document where I call the file and it then prints the text I wrote in that file. The second is a word counting program which if its written correctly I'm hoping will allow me to execute the program which then will allow my to call text a file elsewhere in my computer and count the words in the file, THEN print the number of words in the file back in the powershell.

Here is the word counting program: def filePro(filename): f=open(filename,'r') wordcount=0 for lines in f: f1 = lines.split() wordcount += len(f1) f.close() print('word count:', str(wordcount)) filePro(raw_input("enter file name:"))

currently I'm getting this error when executing the program: Traceback (most recent call last): File "wordcount.py", line 9, in <module> filePro(rawinput("enter file name:")) NameError: name 'raw_input' is not defined

What I'm afraid of is that I need to manually enter the filename that I want the program to count into the IDE instead of having the program itself ask me to pull the file from a directory or something.

also as a side note, "raw_input" has never worked in anything I've ever down with Python but I see if everywhere like it should. Do i need to import a library for it first?

Thanks for reading through all that!