Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
help with homework
#2
Please use python and output tags when posting code and results. I put them in for you this time. Here are instructions for doing it yourself next time.

There are a few problems with your code. First, line 12 is overwriting all the temperatures you got from the user on lines 5-6. You should get rid of that.

Then look at you loop for computing the percentage, and compare it to the one for the length of the list. The thing is that in for x in y:, x and y need to be two different things. So drop the s on the first temperatures on line 16 and the one on line 17.

That will make it work, but it gives the wrong answer. You're calculating something between an average and a percentage. What you want is the percentage greater than 16. So you need the number of temperatures greater than 16, which is what you should be calculating on lines 16-17. It will be a lot like lines 21-22, but will only add one if the temperature is greater than 16 (if temperature > 16:). Then divide that by length.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
help with homework - by lga13 - Nov-19-2018, 02:01 PM
RE: help with homework - by ichabod801 - Nov-19-2018, 02:30 PM
RE: help with homework - by Larz60+ - Nov-19-2018, 02:31 PM
RE: help with homework - by Larz60+ - Nov-19-2018, 02:32 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020