• achu3p
Python; have to use a for loop to ask "How many cookies were sold in week [-]". What am I doing wrong and how can I fix it?: for i in range(1,5): sold = float(raw_input("How many cookies were sold in week" , i , "? "))
Computer Science
  • Stacey Warren - Expert
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • chestercat
I got my questions answered at in under 10 minutes. Go to now for free help!
  • anonymous
raw_input function only accepts 1 parameter -- a prompt string -- and you're giving it 3. what you probably wanted to do is to pass a formated string in there, so it should look as follow: for in in range(1,5): sold = float(raw_input("How many cookies were sold in week %d? " % i))
  • anonymous
note how this: "How many cookies were sold in week %d? " % i is actually a single string after it's fully evaluated (!)

Looking for something else?

Not the answer you are looking for? Search for more explanations.