Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

danmei Group Title

Can someone tell me why the output on this is 4 times? Lloyd = { "name":"Lloyd", "homework": [90,97,75,92], "quizzes": [ 88,40,94], "tests": [75,90] } Tyler = { "name":"Tyler", "homework": [0,87,75,22], "quizzes": [0,75,78], "tests": [100,100] } student = ["Lloyd", "Alice", "Tyler"] def average(student): for person in student: ave = float(sum(student["homework"]))/len(student["homework"]) print ave average(Lloyd)

  • one year ago
  • one year ago

  • This Question is Closed
  1. lh4219 Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    The print avg should be directly under the for

    • one year ago
  2. danmei Group Title
    Best Response
    You've already chosen the best response.
    Medals 1

    thanks, that did it!

    • one year ago
  3. MicroBot Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    actually your code is strange...what are you supposed to do? cause like that it gives only the average of the asked student but you have code u dont need at all.

    • one year ago
  4. MicroBot Group Title
    Best Response
    You've already chosen the best response.
    Medals 0

    Lloyd = { "name":"Lloyd", "homework": [90,97,75,92], "quizzes": [ 88,40,94], "tests": [75,90] } Tyler = { "name":"Tyler", "homework": [0,87,75,22], "quizzes": [0,75,78], "tests": [100,100] } Alice={ "name":"Tyler", "homework": [0,87,75,22], "quizzes": [0,75,78], "tests": [100,100] } def average(student): ave = float(sum(student["homework"]))/len(student["homework"]) print ave average(Lloyd) this does the same thing. i set Alice as you didnt have her .

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.