A community for students.
Here's the question you clicked on:
 0 viewing
anonymous
 5 years ago
Ok, I've watched the first two lectures and got through problem set 0, now I'm looking at ps1 and am honestly not sure where to start...I don't want to look on here at others' codes, I just need some help on where to start...
anonymous
 5 years ago
Ok, I've watched the first two lectures and got through problem set 0, now I'm looking at ps1 and am honestly not sure where to start...I don't want to look on here at others' codes, I just need some help on where to start...

This Question is Closed

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0What are you stuck with?

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0It shows some "hints"  on the initialize some state variables, is that just assign numbers to a variable? Sorry, I know these are probably dumb questions, but the last time I wrote code was DOS and I was 8, have just used computers since then instead of writing anything...

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0And do you know of anybody that has the handouts that could be posted somewhere? I tried to pause the lecture and copy as much as I could see but I'm wondering if I might be missing something on the handouts...?

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0And I looked at what you had posted previously for help, carl, and this is what I got but it's not returning the right answer... def is_prime(number): if number<2: return False for each in range(2, (number+2)/2): if number%each==0: return False return True tally=0 n=0 while tally<1000: n +=1 if is_prime(n): tally +=1 print n

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0You need to move return True on the very last line of the function, back one level of indentation. It should line up with both the `if` and the `for`. That way it'll always run so long as no other return statement has run. There are two other's, both return False.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Thank you! That did it! Now I have to figure out the other problem on that set before I go to the next lecture...been way too long since I did anything like this!

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Any tips on the second one?

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Something to do with logs?

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0I haven't gone over it myself yet. I saw someone else talking about it. If you get stuck, jut ask for a hand and we'll work it out.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Yeah, sum of the logarithms of all the primes from 2 to some number, and print out the sum of the logs and the primes, the number n, and the ratio of these two quantities...please tell me this class doesn't take math beyond precal?

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0You might want the following commands import math math.log(x) I find this course focusses way too much on maths. I think that they do it because maths problems make good programming challenges and everyone at MIT has, I assume, pretty hot math skills. Are you looking to learn computer science or programming Python? Because they're worlds apart in my opinion.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I wanted to learn to write code again. As I said, the last program I wrote anything for was DOS, so it's been a long time. Though I'm very computersavvy, I'd like to be able to program as well.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Ah, then Python it is. You can learn a lot from these courses, they are very high quality resources, but they're not very good at teaching Python ~ they don't claim to be any good at it either. You might want to have a look for a big pack of Python books, there's definitely a torrent around some place full of all the latest additions. You might want to have a look through that, within the bounds of fair usage, and buy whatever ones you like learning from. I found Learning Python, Mark Lutz, O'Reilly Media, the best single on Python yet. There's a ton to learn from and if you get stuck, you can always try us in here. Don't beat yourself up over struggling to keep up with MIT kids. Just have fun.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I'm trying to have fun, I've always loved learning so it feels good to challenge myself again. I admit I am my own worst critic though. I homeschool my kids, but the oldest is 5th grade, so this is definitely different! I've printed off two of the books included in the readings for this course and purchased the one book they suggested on the course's site, I'll look at the book you suggested as well, thanks for that info! Now, onto problem two of that set! :)

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0http://thepiratebay.org/torrent/5534569/85_Python_programming_books_(May_2010)_(5_new) Obviously you'll be braking the law if you go mad with this, but it's ok to just see what you think before you commit the cash.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Ok, another dumb question  what program do you open/view these with? I'm on a Mac...

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0You seem determined. Fair play. Let me know if you get stuck, I don't mind getting stuck in if it helps someone. My maths isn't great, but I'm smart enough and I know a little Python. Your kids are home schooled? Well done for that. Mine are only 21 months and one week, so it's early days, but I have enormous respect for people who feel a personal responsibility for educating their children. Medal for that.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Ah, you need a torrent client. bittorrent or something. I'm not sure for a Mac, but it'll be easy to sus out if you look online. You need an app to get the file, it's a peer to peer thing.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Mine are 11, 9, almost 7 and almost 5 and thank you, it's worth it but it's a lot of work (I obviously don't do things halfway!). Thank you for the help, I can do Algebra well but that's about it lol. Ok, I'm looking for a torrent client now, thank you!

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0There should be some free ones online, it's one of those type of apps. Pop back in here any time you want some advice. It's nice to chat to some one who is clearly up for doing the work, just wants a bit of help here and there. You wouldn't believe how many people just post their homework ~ they don't even try and crack it. You have to assume the teacher gave them something doable? How hard can it be? There's helping each other out and then there's taking the ****.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Found one! Using Transmission, it is highly recommended for Mac. And I want to do the work, have never been afraid of working hard! Guess that's one reason it's hard when I run into a brick wall because I'm used to being able to figure things out. I really appreciate the help! I'm going to study some of this info and work on this next problem  will holler if I get stuck again. :)

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0No worries. An ability to selfteach, such a rare skill now days, is about the best skill you can have to build on in what you're doing. The web is techcentric, there's a ton of information on IT type stuff, if you're willing to study it, but it does require some tenacity. I use Transmission myself, I'm on Ubuntu, a Linux distro. I didn't know Macs had Transmission. Yeah, works a treat. It's standard on Ubuntu and I've never thought to change it.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Actually, I fancy a challenge. I wrote a script over the last couple of days that turns Python scripts into HTML pages. I've done explanatory scripts for the first two problems, I guess I should do the logs bit. I'll have a look at it now. What do you think to this pagemaker's output? I think it needs tweaking a bit, but I just wondered what you thought.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I'm just glad to find courses I can do this with online! Having 4 kiddos, you can probably imagine I can't afford to do much collegewise right now (I have an Associate's, but then had kids and stayed home with them) without going into debt which I won't do. And Transmission looks great, glad to find a good one! I haven't done anything with Linux but have heard good things about it. Either way, I won't use a Windowsbased PC anymore, and I love my Mac. I'm actually doing two courses from MIT right now  this one and the Civil War and Reconstruction course in History (one of my other favorite subjects). And, of course me being me, I already have a list of other courses I want to work on after this. I wanted to do more at once, but I've got a lot on my plate right now with the kids and being involved in a sport myself. Oh wow, that looks great! (That was a HUGE help by the way!) Not sure what tweaking you'd do, it looks really good as is, is clear and to the point...

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Thank you very much. That's what I was aiming for. I just read the MIT thing and didn't really understand a word of it, so I guess I'm going to learn something new today. It's nearly 12.30am here, UK, so I might not get this one done tonight, but I'll have to do it now I've started.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0I've been learning programming for a couple of years and did a bunch of stuff with computers before that. I only went to the MIT 6.00 course to get some background on the science behind it all, but it seems to be turning rapidly into a maths course.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0LOL understand having to finish things! You're welcome, of course. And I"m glad that didn't make much sense to someone other than me! Yeah, this course is a challenge, for sure! Nice to have someone to sound off to! Don't stay up too late! It's 6:33 pm here (Oklahoma, US), so I'm trying to get some studying done! MIT isn't the only OpenCourseWare, just so you know. I found this the other day but am trying to resist looking too much until I'm done with the courses I'm working on right now! http://www.ocwconsortium.org/courses/ocwsites

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0Nice one for the link, I'll have a look at it tonight and start on logs tomorrow I think. No doubt, we'll see each other around. Speak soon.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Sounds great, thank you! Have a great night! :)

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0when you go to the video's page, at the bottom there are some tabs  in the "Related Resources" tab is a link to the handout for the lecture.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0I am stuck on problem set 1, even after reading this thread. I have looked up other people's answers, found on curiousreef.com, but they had elements that were not included in the lecture. I have watched the lectures and did some of the optional readings, but I feel like I am definitely missing something somewhere. For example, in this thread, avasbabygirl typed def is_prime(number): I don't remember the lecture defining what that statement does, and I have not gotten to an explanation in the reading yet. Is there another resource I am supposed to read or watch before attempting PS1? I tried starting it, assigning variables to prime, count, and a divisor, but did not know what to do from there just from watching Lectures 1 and 2.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Also, I apologize if I was supposed to start a completely new topic. I replied to this thread because it is directly related to my problems.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0and just saw carl's explanation on the bottom. I'll read up on it and see. Sorry for any intrusion.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0aliron, you're perfectly welcome to discuss this here, it's easier to pick up a thread and continue it than to repost everything again somewhere else. Quite a few people seem to be coming in with this problem actually. As I've mentioned in other recent posts, the MIT course doesn't really try and teach Python so much as use it to teach CS in general so if you want to learn Python, you'll need to tap other resources, good books are still unbeatable as the core resources to build on, but places like this are really handy if you're stuck with something. What def does is it starts a definition. It says 'here in lies a definition of a function', it's also used to define methods, but that comes a bit later, and functions and methods are practically the same thing. After the def keyword, comes the name of the function. This can be anything you like, it's like a variable name, just pick something that expresses what the function does. Then you have some parentheses, and then a colon to end the def line and begin the definition itself. The definition is all indented. A simple example: def say_hello(): print 'Hello World!' This function is named `say_hello`. Once you have this function defined in your script, normally near the start of the script, you can use it by 'calling the function'. You do this by calling its name with parentheses. say_hello() If you did the above, the computer would call `say_hello` and the definition will be run, so the computer would print Hello World! You can pass 'arguments' to a function, which it can use to figure out what to do. You pass them in the parenthesis. a = 5 b = 10 say_hello(a, b) This would call `say_hello` and pass it the two values, `a` and `b`. This would cause an error as `say_hello` doesn't take arguments. Let's do a function that does: def adder(x, y): return x + y This function, named `adder`, takes two arguments and calls them `x` and `y`, though they can be called anything. If we now do adder(a, b) the call to `adder` passes the value `a` first, so the function assigns its value, 5, to the functions local variable `x`, then it assigns the next value given, `b`, to the local variable `y`. Then it runs the function. Note there are as many arguments passed as the function receives. You'd get an error otherwise. The return statement say what the function should return when it runs, some functions don't have a return statement, like `say_hello`, some have many return statements, different ones being run depending on the conditions. Once a function returns something, it quits and waits to be called again. If we do sum = adder(3, 50) the variable sum is assigned the value 53. You can call the function as many times as you like, so long as you pass it valid arguments each time. print adder(1, 20) print adder(20, 3) print adder(3, 5.5) 21 23 8.5 You could even get away with print adder('abc', 'def') abcdef but that's because 'abc' + 'def' is a legal Python expression. Functions can be much more sophisticated of course, but this is the basics of how they work. Note a function that doesn't have a return statement, or at least doesn't run one, will return the explicit None value, to let your computer know the internals of the function have been run to some conclusion. The interpreter has reached the bottom of the function and still not hit a return statement.

carlsmith
 5 years ago
Best ResponseYou've already chosen the best response.0P.S. If you only trying to find if a number is prime, you might want to read this script, the one above abstracts this one into a function, then calls it a bunch of times to get the one thousandth prime.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0Thank you, bwCA for that info, that helps! And you can comment on here if you want to, aliron, no intrusion at all! :) Is it just me or does it seem like the problems sets and lectures are one off? Like you should do ps1 after lecture 3? I dunno, maybe it's just me...

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0:).. on the left hand of the main page is a link to the calender. It shows when the assignments are handed out and due in relation to the lectures.

anonymous
 5 years ago
Best ResponseYou've already chosen the best response.0That I did find, thanks, bwCA, just didn't see the tabs below the lectures (probably mainly b/c I watch them fullscreen on my laptop!). :)
Ask your own question
Sign UpFind more explanations on OpenStudy
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
 Engagement 19 Mad Hatter
 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.