On 08/08/15 00:05, Ltc Hotspot wrote:
Hi Alan,
On line 15, I replaced: 'count[address] = count.get(address, 0) + 1'
with 'line = Counter(address)'.
line = Counter(address)
will create a new Counter object with the address in it with a count
value of 1.
Every line in the file will create a
On 8/6/2015 5:30 PM, Ltc Hotspot wrote:
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
As you're clearly interested in learning python, you may find working
the tutorial beneficial as it steps you through the fundamentals of
python
Alan,
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
http://tinyurl.com/nvzdw8k
Question1: are these assumptions true, above?
Mark,
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
View attached screen shot file, image file shows a copy of the
counter: cou[wrd] =cou.get(wrd,0) +1
Please, explain the differences in counter methods?
Hal
On Thu, Aug 6, 2015 at
Question1: How type of argument should I use for dict, i.e.,user argument
or list argument.
Read captured traceback:
TypeError
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 =
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:
TypeError
Traceback (most recent call last)
C:\Users\vm\Desktop\apps\docs\Python\assignment_9_4_26.py in module()
1 fname =
On 07/08/2015 01:30, Ltc Hotspot wrote:
Mark,
I'm following the instructor's video exercise, available at
https://www.youtube.com/watch?v=3cwXN5_3K6Q.
View attached screen shot file, image file shows a copy of the
counter: cou[wrd] =cou.get(wrd,0) +1
Please, explain the differences in
Hi Mark,
Why is Counter not defined on line #15: line =
Counter(address),i.e., NameError: name 'Counter' is not defined?
Share a chat session at http://tinyurl.com/oull2fw
View line entry at http://tinyurl.com/oggzn97
Hal
On Fri, Aug 7, 2015 at 12:14 AM, Mark Lawrence breamore...@yahoo.co.uk
On 07/08/15 19:18, Ltc Hotspot wrote:
I want to find the max val , keys and values are defined on line 10:
for kee, val in count.items():
Yes we know that, but you are not answering the questions we pose.
Instead you seem to post random changes to your code and ask new
questions which
Mark,
Visit the following URL link to view a captured copy of the latest code
revision, available at http://tinyurl.com/nvzdw8k
Regards,
Hal
On Thu, Aug 6, 2015 at 10:17 AM, Ltc Hotspot ltc.hots...@gmail.com wrote:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
Hi Alan,
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
URL link to the revisions are available at http://tinyurl.com/nvzdw8k
Question: How do I define Counter
Revised code reads:
fname = raw_input(Enter file name: )
handle =
On 06/08/15 19:30, Ltc Hotspot wrote:
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
You moved counter but it is still a dict() and you
don't use it anywhere.
URL link to the revisions are available at
On 06/08/15 03:27, Ltc Hotspot wrote:
The output as reported by the latest code revision: c...@iupui.edu
mailto:c...@iupui.edu 1← Mismatch
Looks like python continues to print the wrong data set:
Python will print what you ask it to. Don't blame the tool! :-)
for line in handle:
if
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Regards,
Hal
On Wed, Aug 5, 2015 at 9:03 PM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 05/08/2015 23:58, Ltc Hotspot wrote:
Hi Mark,
Address identifies the email address with the maximum number
On my breath and soul, I did:
Counter objects have a dictionary interface except that they return a zero
count for missing items instead of raising a KeyError
https://docs.python.org/3/library/exceptions.html#KeyError:
c = Counter(['eggs', 'ham'])
On Thu, Aug 6, 2015 at 11:59 AM, Mark
On 07/08/15 00:11, Ltc Hotspot wrote:
Questions(1):Why does print line, prints blank space; and, (2) print
address prints a single email address:
See my previous emails.
You are not storing your addresses so address only holds the last
address in the file.
line is at the end of the file so
On 06/08/2015 20:05, Ltc Hotspot wrote:
On my breath and soul, I did:
Counter objects have a dictionary interface except that they return a zero
count for missing items instead of raising a KeyError
https://docs.python.org/3/library/exceptions.html#KeyError:
That's nice to know. What do the
On Thu, Aug 6, 2015 at 3:00 PM, Alan Gauld alan.ga...@btinternet.com
wrote:
On 06/08/15 19:30, Ltc Hotspot wrote:
I moved counter outside the loop and below dict, maxval = None
maxkee = None are both positioned outside the loop.
You moved counter but it is still a dict() and you
don't use
On 06/08/15 18:17, Ltc Hotspot wrote:
View revised code here:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
c = Counter(['address'])
count = dict ()
maxval = None
maxkee = None
for kee, val in count.items():
maxval = val
maxkee = kee
for line in handle:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Try it at
On 06/08/2015 18:17, Ltc Hotspot wrote:
On Thu, Aug 6, 2015 at 8:28 AM, Mark Lawrence breamore...@yahoo.co.uk
wrote:
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c
On 06/08/15 18:17, Ltc Hotspot wrote:
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
You didn't do what Mark suggested.
Did you read the documentation about Counter?
NameError
Traceback (most recent call last)
2 handle = open (fname, 'r')
3 c =
The revised output reads:
In [3]: %run assignment_9_4_9.py
Enter file name: mbox-short.txt
c...@iupui.edu 14
The desired output: c...@iupui.edu 5
Question: How do I trace the source of the count?
Revised data code reads:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
count =
Hi Alan
The output as reported by the latest code revision: c...@iupui.edu 1 ←
Mismatch
Looks like python continues to print the wrong data set:
In [11]: print val
1 In [12]: print kee r...@media.berkeley.edu In [13]: print address
c...@iupui.edu
In order to complete the assignment, using data
On 06/08/2015 05:22, Ltc Hotspot wrote:
Please don't top post here, it makes following long threads difficult.
Mark,
Replace count[address]= count.get(address,0) +1 with c =
Counter(['address'])?
Try it at the interactive prompt and see what happens.
Regards,
Hal
On Wed, Aug 5, 2015
Hi everyone:
I want to write a python program that reads through the data file of
mbox-short.txt.Mbox-short.txt, i.e., download is available at
http://www.py4inf.com/code/mbox-short.txt.
Secondly, I want for python to figure out who sent the greatest number of
mail messages.
The output should
On 05/08/2015 23:58, Ltc Hotspot wrote:
Hi Mark,
Address identifies the email address with the maximum number of sends:
c...@iupui.edu.
Secondly, we are missing a count on the number of messages sent by
c...@iupui.edu, i.e., 5.
Thirdly, maxval 'none' is not defined on line # 24
Questions:
On 06/08/15 02:05, Ltc Hotspot wrote:
The revised output reads:
In [3]: %run assignment_9_4_9.py
Enter file name: mbox-short.txt
c...@iupui.edu mailto:c...@iupui.edu 14
The desired output: c...@iupui.edu mailto:c...@iupui.edu 5
See my other post.
Count the number of letters in the address.
On 05/08/15 23:58, Ltc Hotspot wrote:
fname = raw_input(Enter file name: )
handle = open (fname, 'r')
for line in handle:
if line.startswith(From: ):
address = line.split()[1]
So far so good.
## The program creates a Python dictionary that maps
## the sender's mail address
On 05/08/15 15:15, Ltc Hotspot wrote:
Raw data code reads:
Being picky here but data and code are very different
things (in most languages at least) and what you have
below is definitely code not data.
Meanwhile there are lots of issues in this code...
fname = raw_input(Enter file name: )
On 05/08/2015 15:15, Ltc Hotspot wrote:
Hi everyone:
I want to write a python program that reads through the data file of
mbox-short.txt.Mbox-short.txt, i.e., download is available at
http://www.py4inf.com/code/mbox-short.txt.
Secondly, I want for python to figure out who sent the greatest
-Original Message-
From: Tutor [mailto:tutor-bounces+crk=godblessthe...@python.org] On
Behalf Of Mark Lawrence
Sent: Wednesday, August 05, 2015 3:23 PM
To: tutor@python.org
Subject: Re: [Tutor] Dictionary Issue
On 05/08/2015 15:15, Ltc Hotspot wrote:
Hi everyone:
I want
On 05/08/15 23:36, Clayton Kirkwood wrote:
It looks like the problem is with count=dict()
Should be count=dict{}
I may be wrong - U'm still a neophyte.
Yes, you're wrong! :-)
the correct form is as shown
count = dict()
Its calling the type operation which looks like
any other function and
However, there is a traceback message:
In [40]: %run 9_4_4.py
File C:\Users\vm\Desktop\apps\docs\Python\_9_4_4.py, line 19
count = dict()
^
SyntaxError: invalid syntax
Syntax error reporting is approximate: you might need to look a few lines
earlier to get at the root
Hi Mark,
Address identifies the email address with the maximum number of sends:
c...@iupui.edu.
Secondly, we are missing a count on the number of messages sent by
c...@iupui.edu, i.e., 5.
Thirdly, maxval 'none' is not defined on line # 24
Questions: How do we define the value of none for the
35 matches
Mail list logo