On 14/04/13 06:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
You calculate the average by summing the list, then dividing by the number of
items.
To sum a list of n
On 14/04/13 05:30, Saad Bin Javed wrote:
This is what I'm using:
for item in lst:
if item.startswith(('Mon','Tue','Wed','Thu','Fri','Sat','Sun'__))__:
dict[item] = []
saveItem = item
else:
dict[saveItem].append(item.strip())
gives:
File "gcalcli_ag
On 14/04/13 04:19, Saad Javed wrote:
This creates a dictionary whose keys are out of order in terms of dates.
Dictionaries are unordered. That is to say, they have no defined order, when
you print them, or iterate over them, items will appear in whatever order
they happen. If you modify a dic
On 14/04/13 03:38, Saad Javed wrote:
What just happened here? :)
I am trying to learn python so i'm sorry if my mistakes seem trivial.
I have to ask the same question -- what just happened here? Why are you
upset? Mark has given you some good advice, and even added some
light-hearted joviali
Thank you for the help, it was really convenient.
From: ALAN GAULD
To: Mariel Jane Sanchez
Cc: "tutor@python.org"
Sent: Tuesday, April 9, 2013 6:29:57 PM
Subject: Re: [Tutor] Chapter 3 Projects
Forwarded to group. Please use ReplyAll when responding to
On 13/04/13 21:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] )
> and then subtract the avg from the original numbers
> in the list and print?
This sounds like homework which we don;t do for you.
However to calculate the average take the sum and
On Fri, Apr 12, 2013 at 7:52 PM, Saad Bin Javed wrote:
> Hi, I'm using a script to fetch my calendar events. I split the output at
> newline which produced a list 'lst'. I'm trying to clean it up and create a
> dictionary with date:event key value pairs. However this is throwing up a
> bunch of er
On 13/04/2013 21:53, Soliman, Yasmin wrote:
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
lst = [2,5,8,7,3]
avg = sum(lst) / len(lst)
print(avg)
for n in lst:
print(n - avg)
Also, if I ha
How can I calculate the average of a list of numbers (eg [2,5,8,7,3] ) and then
subtract the avg from the original numbers in the list and print?
Also, if I have a nested list:
sick_patients=[['Sam', 'M', 65, 'chest pain', 101.6], [['Sarah', 'F', 73,
'dizziness', 98.6], [['Susie', 'F', 34, 'he
On 13/04/2013 21:06, Saad Javed wrote:
I don't know what I'm doing wrong here. Ive tried copy-pasting the line.
I've tried entering underscores manually. doesn't work.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription optio
I don't know what I'm doing wrong here. Ive tried copy-pasting the line.
I've tried entering underscores manually. doesn't work.
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo
On 13/04/2013 20:30, Saad Bin Javed wrote:
On 04/14/2013 12:08 AM, Mark Lawrence wrote:
On 13/04/2013 19:45, Saad Javed wrote:
for item in lst:
if
item.startswith(('Mon','Tue','Wed','Thu','Fri','Sat','Sun'__))__:
myDict[item] = []
On 04/14/2013 12:08 AM, Mark Lawrence wrote:
On 13/04/2013 19:45, Saad Javed wrote:
for item in lst:
if
item.startswith(('Mon','Tue','Wed','Thu','Fri','Sat','Sun'__))__:
myDict[item] = []
saveItem = item
On 13/04/2013 19:45, Saad Javed wrote:
for item in lst:
if
item.startswith(('Mon','Tue','Wed','Thu','Fri','Sat','Sun'__))__:
myDict[item] = []
saveItem = item
else:
myD
> for item in lst:
>> if
>> item.startswith(('Mon','Tue','**__Wed','Thu','Fri','Sat','Sun'**))__:
>> myDict[item] = []
>> saveItem = item
>> else:
>> myDict[saveItem].append(item._**_strip())
>>
>> Returns:
File "gcalcli_agenda_test.
On 13/04/2013 19:19, Saad Javed wrote:
Don't fight Python, unlike this chap[1] :) Basically if you're
looping around any data structure you rarely need to use indexing,
so try this approach.
for item in lst:
if
item.startswith(('Mon','Tue','__Wed','Thu','Fri','Sat
>
> Don't fight Python, unlike this chap[1] :) Basically if you're looping
> around any data structure you rarely need to use indexing, so try this
> approach.
>
> for item in lst:
> if item.startswith(('Mon','Tue','**Wed','Thu','Fri','Sat','Sun'))**:
> myDict[item] = []
> save
What just happened here? :)
I am trying to learn python so i'm sorry if my mistakes seem trivial.
On Saturday, April 13, 2013, Mark Lawrence wrote:
> On 13/04/2013 15:34, Saad Bin Javed wrote:
>
>> I ran into a bit of problem with my revised code based on Steven's
>> suggestions.
>>
>> lst = [''
On 13/04/2013 15:34, Saad Bin Javed wrote:
I ran into a bit of problem with my revised code based on Steven's
suggestions.
lst = ['', 'Thu Apr 04 Weigh In', '', 'Sat Apr 06 Collect
NIC', ' Finish PTI Video', '', 'Wed Apr 10 Serum
uric acid test', '', 'Sat Apr 13
I ran into a bit of problem with my revised code based on Steven's
suggestions.
lst = ['', 'Thu Apr 04 Weigh In', '', 'Sat Apr 06 Collect
NIC', ' Finish PTI Video', '', 'Wed Apr 10
Serum uric acid test', '', 'Sat Apr 13 1:00pm Get flag from
dhariwal', '', 'Su
On 13/04/13 09:48, Albert-Jan Roskam wrote:
I think I have to make a diagram of this. This stuff is quite hard
You could use a simple UML class diagram (class -> table). See the OOP
topic in my V3 tutorial for simple examples.
Or you could use a proper entity relationship diagram(ERD) - see
On 12 Apr 2013 21:25, "Steven D'Aprano" wrote:
> Also, you might find it easier to process the list if you strip out empty
items. There are two simple ways to do it:
>
>
> lst = [x for x in list if x != '']
> # or
> lst = filter(None, lst)
Hi all,
For the first, I would use
lst = [x for x in l
Hi Alan,
Thanks for your reply!
> Subject: Re: [Tutor] design question (Django?)
>
> Some clarification please.
>
>> (1) Database design. Here are the database tables I think are necessary:
>> tblPostalcode: pc6, streetname, nHouseholds, isVisitable, remarks
>> tblCollectorSelection: colle
Some clarification please.
(1) Database design. Here are the database tables I think are necessary:
tblPostalcode: pc6, streetname, nHouseholds, isVisitable, remarks
tblCollectorSelection: collectorname, streetname, selectiondate
streetname is in both so presumably is the link between collecto
Hi,
I am doing volunteer work for a charity. The job is to coordinate money
collecting activities of people who
raise money with collecting-boxes. I am involved with one postal code 4 (pc4)
area (our postal codes have the format 1234 AB (postal code 6). So 'one postal
code 4 area' means [0-9]
25 matches
Mail list logo