elz: (ada-tubes)
[personal profile] elz posting in [community profile] intro_to_cs
First:

Open to: Registered Users, detailed results viewable to: All, participants: 25


Tickyboxes!

View Answers

Finished lecture 2
24 (96.0%)

Finished problem set 1
15 (60.0%)



Also, it occurs to me that it might be handy to have a place to post/discuss solutions to the problem sets, to see what we can learn from each other in the absence of TAs. If you actually go to MIT and the problem sets are still the same, don't read these. ;)

Fire away!

Date: 2009-11-17 01:49 am (UTC)
zulu: Carson Shaw looking up at Greta Gill (Default)
From: [personal profile] zulu
Still working on problem 2, but I'm stuck because I can't sum logs. When I try, I get "Error: float required". I've tried assigning the answer as a float, but that doesn't work.

Are there any readings that go along with this week that might help?

Here's my test case:

from math import *
number = log(2)
print number # this works
primes = (2, 3, 5, 7, 11, 13) # this is just as a test case
number = 6
sum = sum(log(primes)) # this is where I get an error message
print sum
ratio = sum/number
print ratio

Date: 2009-11-19 05:35 am (UTC)
bellerina: (Default)
From: [personal profile] bellerina
I think that you can't take the log of an array-- it's not distributive. I tried the same thing and got the error, so I ended up taking the log of each prime before I put them into the array. Not the most elegant solution, but it works...

Date: 2009-11-19 03:33 pm (UTC)
zulu: Omar Epps, looking awesome (house - epps)
From: [personal profile] zulu
Ahh, thanks. I'll try that. Still stuck way back here and I think we have another lecture and problem set coming up...eep!

Profile

Introduction to Computer Science

July 2010

S M T W T F S
    123
45678910
11121314151617
18192021222324
2526272829 3031

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 25th, 2025 09:56 am
Powered by Dreamwidth Studios