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

tcc8m Group Title

Hi I have a question on Pract Quiz1 #5. I posted the question and the code in the pastebin below. Thanks http://pastebin.com/YwLYPwPQ

  • one year ago
  • one year ago

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

    *

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

    raw_input() returns a string.

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

    # The following code contains two semantic errors. Correct it so that it reads in integers until the user enters -1, and then prints the sum of the integers (8 points) def getLines(): inputs = [] while True: line = raw_input('Enter a positive integer, -1 to quit: ') # I have casted the value to int here if int(line) == -1: break # I have casted the value to int here. You can either put it here or in the for loop to convert them while adding them inputs.append(int(line)) # There is no return value in the original code. This should fix it! return inputs total = 0 for e in getLines(): total += e print total

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

    Thanks everyone. I got it now!

    • 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.