Re: [Tutor] Help with return results statement.

2015-10-22 Thread Vusa Moyo
Hi Guys. Thanks for the responses and assistance. I came right after-all. The last 2 blocks read the following. def get_class_average(students): results = [] for a in students: b = float(get_average(a)) results.append(b) return average(results) students = [lloyd, al

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Alan Gauld
On 22/10/15 10:03, Vusa Moyo wrote: Hi Guys. Thanks for the responses and assistance. I came right after-all. The last 2 blocks read the following. Glad you are happy but there is still something you could improve: def get_class_average(students): results = [] for a in students:

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Vusa Moyo
Thanks Alan. Removed that . = # Add your functions below! def average(numbers): total = sum(numbers) total = total / len(numbers) return total def get_average(student): homework = average(student["homework"]) quizzes = average(student["quizzes"]) tests = average(stude

Re: [Tutor] Help with return results statement.

2015-10-22 Thread Danny Yoo
An additional suggestion: > = > # Add your functions below! > def average(numbers): > total = sum(numbers) > total = total / len(numbers) > return total Don't re-assign total here. The problem is that conceptually "total" no longer represents the total in the second assignment.

[Tutor] Create complex dictionary

2015-10-22 Thread jarod_v6--- via Tutor
Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) What is the most pythonic way to build a dictionary of dictionary?thanks for any help! ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Create complex dictionary :p:

2015-10-22 Thread Thomas C. Hicks
On 10/23/2015 05:19 AM, jarod_v6--- via Tutor wrote: Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) What is the most pythonic way to build a dictionary of dictionary?thanks for any help! This doesn't look too complex so I am

Re: [Tutor] Create complex dictionary :p:

2015-10-22 Thread Alex Kleider
On 2015-10-22 14:50, Thomas C. Hicks wrote: On 10/23/2015 05:19 AM, jarod_v6--- via Tutor wrote: Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) What is the most pythonic way to build a dictionary of dictionary?thanks for any

Re: [Tutor] Create complex dictionary

2015-10-22 Thread Cameron Simpson
On 22Oct2015 23:19, jarod...@libero.it wrote: Hi!!I would like to prepare a dictionary with complex structure: complex = {name ="value",surname="po",age=poi) Well, in Python you'd write the above like this: complex = {'name': "value", 'surname': "po", 'age': poi} What is the most pythonic

Re: [Tutor] Create complex dictionary

2015-10-22 Thread Ben Finney
jarod_v6--- via Tutor writes: > Hi!!I would like to prepare a dictionary with complex structure: > > complex = {name ="value",surname="po",age=poi) That's invalid syntax (the braces don't match) and it seems to use names from elsewhere. If you mean a dictionary like this:: wibble = {'name'

Re: [Tutor] Create complex dictionary :p: :p:

2015-10-22 Thread Thomas C. Hicks
On 10/23/2015 05:59 AM, Alex Kleider wrote: mydict = dict('name'='value', 'surname'='po','age'='poi') Oops, you are correct! Don't want to put the key names in quotes, I mistyped my experiment. SDG, tom ___ Tutor maillist - Tutor@python.org To uns

[Tutor] Scraping Wikipedia Table (The retruned file is empty)

2015-10-22 Thread Cynthia Alice Andrews
At this point I feel like I am wasting my time by not asking for help. I can't figure out why the file keeps coming back empty. There are no error message, just an empy file. Very frustrating. from BeautifulSoup import BeautifulSoup import urllib2 import csv wiki = "https://en.wikipedia.org/wiki/

Re: [Tutor] Scraping Wikipedia Table (The retruned file is empty)

2015-10-22 Thread Danny Yoo
On Thu, Oct 22, 2015 at 4:01 PM, Cynthia Alice Andrews wrote: > At this point I feel like I am wasting my time by not asking for help. I > can't figure out why the file keeps coming back empty. There are no error > message, just an empy file. Very frustrating. Unfortunately, the formatting of yo

Re: [Tutor] Scraping Wikipedia Table (The retruned file is empty)

2015-10-22 Thread Danny Yoo
On Thu, Oct 22, 2015 at 8:07 PM, Personal wrote: > I figured it out! Thanks for taking the time to respond! No problem; glad you found it. :) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.or