working on ocw 2008 course 6.00 ps1b.py and i can't seem to figure how to get the ratio of the sum and input number. i'm terrible at math and have never done any programming. here's my code so far, it spits out the sum of the logs of the primes and the input number, but then i'm stuck. i'm sure it's something simple, any help is appreciated! http://goo.gl/B8Qca
sum / float(input)
Have you read the Tutorial in the Python documentation? It is pretty good - read as much as you can and try the examples.
i have not, but i just picked up a python pocket reference book today. i'll take a look at the tutorial this evening, though. sum / float(input) seems to work, i'd toyed with the float() function as i'd gotten many errors about input not being a float in some of the code i toyed with, but wasn't sure how to apply it properly and kept getting errors. thank you so much!
Join our real-time social learning platform and learn together with your friends!