[Tutor] Dictionary Issue
ltc.hotspot at gmail.com
Fri Aug 7 20:18:16 CEST 2015
I want to find the max val , keys and values are defined on line 10:
for kee, val in count.items():
Then, maxval determines the max value on line 11:
if val > maxval:
right, view a copy of the revised code at
Question1: are these assumptions true, above?
Question2: dict maps strings into keys and values?
On Thu, Aug 6, 2015 at 11:35 PM, Alan Gauld <alan.gauld at btinternet.com>
> On 07/08/15 01:15, Ltc Hotspot wrote:
>> Question1: How type of argument should I use for dict, i.e.,user argument
>> or list argument.
>> Read captured traceback:
>> Traceback (most recent call last)
>> C:\Users\vm\Desktop\apps\docs\Python\assignment_9_4_26.py in <module>()
>> 1 fname = raw_input("Enter file name: ")
>> 2 handle = open (fname, 'r')
>> ----> 3 count = dict.keys()
>> 4 for line in handle:
>> 5 if line.startswith("From: "):
> You appear to be making random changes to your code
> for no good reason.
> I will not make any further suggestions until you
> start to explain your thinking.
> What do you think the line
> count = dict.keys()
> will do? Why do you want to do that?
> How will it help you solve your problem?
> Alan G
> Author of the Learn to Program web site
> Follow my photo-blog on Flickr at:
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
More information about the Tutor