[Tutor] Help with error

Alan Gauld alan.gauld at btinternet.com
Tue Feb 2 16:21:59 EST 2016


On 02/02/16 15:37, Chelsea G wrote:

> 'issues' and output those results into a text file. I just need some help
> with figuring out how to fix the error I am receiving.

Joel has already pointed out the indentation error in your class.

However there is another problem... but possibly not with your code.

> And then I have another python file where I import my functions and
> run the results. Here is the code for that:
> 
> import functions2
> 
> week_choice = raw_input("Previous Week or Current Week?")if
> week_choice == "current week":
> 	data = functions2.dictionary()
> 	filename = raw_input("What file do you want to use?")
> 	data.populate_dict(filename)
> 	data.total_counts()
> 	data.grouped_counts()
> 	data.json_output()
> 	data.search(filename)
> 	elif week_choice == "previous week":
> 	previous_data = functions2.dictionary()
> 	filename = raw_input("What file do you want to use?")
> 	previous_data.populate_dict(filename)
> 	previous_data.total_counts()
> 	previous_data.grouped_counts()
> 	previous_data.json_output()
> 	previous_data.search(filename)
> 	else:
> 	print "That choice is not correct"

The if, elif and else indentation is way off
Now that is probably due to emails being messed up,
but it makes it hard to give sensible feedback since
there could be bugs but we can't see them.sensibly...

Please be sure to send the complete error message
and not just summarize it and also use plain text,
especially when posting code.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list