100 thoughts on “Lec 3 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008

  1. Agreed. He stated in the first video that this is not a course on Python. He's using the language to illustrate important concepts in computer programming and he clearly knows quite a bit about those.

  2. This is how some professors learn as their going. He's probably taught this very same course using several different languages in the past.

  3. You are quite correct. I spotted that mistake as well. The condition should check if ans times ans is less than x (ans * ans < x) instead of if ans times ans is less than or equal to x (ans * ans <= x).

    I believe this type of mistake is pretty common, even among seasoned programmers. This is why it's important to test every piece of code as it's added to a script.

  4. ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/

  5. "So what have we actually done over the last few lectures?"
    Well according to this video, you've caused about 1.3 million people to get confused and give up!

  6. After less than two weeks worth of the lectures, this series has already surpassed what I learned when I audited a course at my local community college. This is why MIT is MIT, THANK YOU for making this available!

  7. Would it be better practice to use an equation to find, say, an even number instead of iterating to that number? Will it be important in a long term project to use the least amount of iterations as possible or can the resources of modern day computers withhold iterations to the point we don't have to worry about it? I'm just wondering if using iterations when it is not necessary is bad practice. Even though without iterations we cannot collect each number..help? 🙂

  8. The last example?
    Answer 17?
    17 digits? I don't get it. 1952 is a 4 digit number right?

    could someone explain this to me?
    thank you sooo much in advance.

  9. Yes you should be able to read and write basic codes after the past 3 lectures, however, you have to remember that the students are working 9-10 hours each week on problem sets and homework in addition to their recitation (where they can ask and receive answers to questions that weren't necessarily covered in the lecture or require clarification). So, unless you have been following the exact curriculum as the students, you will naturally be a bit behind.

  10. It's also worth mentioning that these MIT students are at MIT because they overachieve and work very hard (of course some are naturally bright without effort but I would bet that a majority are a product of consistent hard-work) so it is very likely they are in fact a few chapters ahead of the lectures (in addition to the problem sets/homework I mentioned in the previous comment). Just keep practicing, thinking and find literature you can read along with.

  11. You only will understand the fundamental building blocks for writing code. The professor has introduced all the building blocks, but don't worry, you'll get there. Just practice.

  12. I'm amazed that people pay to attend MIT when these exact same topics can be learned for next to nothing. Seriously?!?! Parents are paying for some blowhard to teach PYTHON at MIT? Colleges are becoming laughable.

  13. You could either manually add up each individual integer of the numbers, which would take a while or write a for loop script where 1952 are all individual numbers in a list.

  14. go file and open new window
    save as xxxx.py
    then start to write your code on the new opened window.

    In python 3.3 version print works when it is written like this:
    print('——–') or print("——-")

  15. Unbeliveable! On the 13 min I beared to watch I found 2 errors! He proposes to do a fluxogram of a square root but he does de test ans * ans <= X instead ans * ans < X as stop condition! Not only that, if he is explaining basics why he does not initializes the variable X!!!  Is it me or MIT quality??

  16. When i starting watching these videos I said, "Boy, understanding these will be painful" but these proffesors make it easy and simple. Good job MIT 😀

  17. At one point in the video, Prof. Grimson says that the square root program is a "linear" program. This is not correct. If we start out with a number like 16, it takes ~ 4 steps to find it. If we multiply that number by 4 – i.e. 16*4 = 64 – then a linear program would take ~ 4*4 = 16 steps to find it. However, it really only takes ~ 8 steps to find it. Or, ~ 4 * √4. Because the program only has to look at all the numbers less than or equal to the square root of our input, it is an O(√n) time algorithm. That is, as the size of the input increases, the time of the algorithm increases relative to the square root of the input.

  18. Another small note for any Python beginners watching:

    Throughout the video he writes things like

    'divisor ', i

    where there is a space after the word divisor. This is redundant because in Python, spaces are added automatically between comma-delimited arguments. In other words, something like 'hello','there' will print out as 'hello there'. If instead he was using the concatenation operator, +, then the extra spaces would be necessary. Then he would write something like

    'divisor ' + i

    to get the correctly-formatted output.

  19. 24:30, shouldn't the second "if" and "else" statements be indented after the "while" statement so that we are sure 'ans * ans', is not greater than 'x'?

  20. I don't get the code and correction happening just after the 43 min. mark. I tried to run it but it returns no values. This is the bit of code that ends by saying "divisors = divisors + (i,)." What is going on here?

  21. These videos are extremely helpful…
    I'm trying to gain as much knowledge as I can before I begin taking classes this fall for network management…
    I'm very interested in programming.
    This is a great starting point tool.

  22. When the lecturer wrote on the board, i feel an urge inside me to take notes. But lol i am watching this video with my sleepy eyes, sitting on the bed. i hope i can restart learning programming after these 12 lessons.

  23. Those latecomers at 1:20 will be forever immortalized by M.I.T. as latecomers. You want a job at Google?? I don't think so M.I.T. research shows that you come in late!

  24. I'm planning on watching this entire series, and unfortuately I've found myself screaming at the screen, only to have a student correct the professor 10 seconds later. Considering the material will only get more difficult and errors, less easily caught. Does MIT provide some sort of errata for these lectures?

  25. I tried the code used in 42:48 of the video and apparently python doesn't accept the line. How else can we collect the intermediate values instead?

    divisors=divisors + (i) 

    When I run the code, it showed me this.

    TypeError: can only concatenate tuple (not "int") to tuple

  26. Adjustment for the code:
    divisors = divisors + (i,)
    it won`t work unless you type the "," after the variable for the new Python

  27. "…the main thing to keep in mind is the general principle that people are dumb and will make mistakes"
    -Prof. Guttag

    Heh. Indeed! Another great lecture. Some great points on style and defensive programming – thanks again MIT!

  28. Since when is 10 not a divisor of 10?
    that "range" thing calling all up to, but not including x, could bite you in the behind if used elsewhere 🙂

  29. Does the Introduction to Computer Science and Programming Using Python
    6.00.1x series that starts August 31, 2016 use Python 3.5?

  30. I've done notes(mind map) on 1 to 3 lessons, maybe someone find it useful.
    File gif(100kB, 2738×1197) https://1drv.ms/i/s!ArdAwIvPYluucGWDug2zDMZsXic

  31. I am in my first year of high school and I am very interested into getting into MIT. What can I do to increase my chances? I get all A's and planning on taking AP Computer Science and most other classes Honors or AP. What else can I do?

  32. What on earth is going on from 47:45? What does c mean in the for loop? I have watched over and over at least 10 times and can't figure out what is going on. I understand the overall concept, which is to get the sum of the numbers, but i can't understand the method behind it. I can't understand how the answer comes about. I understand type conversion but get completely lost at 48:30. It just makes no sense. Thanks in advance…

  33. As the lectures progress the view count slowly decreases… The 1st was view by 3.5 million times and it's down to 346 thousands views…

  34. I wrote a program to check whether a number is prime or composite. I got this error "for i in range(1,x):
    TypeError: range() integer end argument expected, got str."
    Can someone help me please ??
    My code is as follows:
    x=raw_input('enter any number')
    k=0
    for i in range(1,x):
    if x%i==0:
    k=k+1

    if k==2:
    print'The number is prime'
    else : print 'The number is composite'

  35. I have no real coding experience and am having quite a hard time following this, not sure if it's a sign coding isn't for me or just that this course isnt intended for someone with literally zero experience.

  36. I believe these same courses are offered in a workabl form via edx.org. Look for MITX CS 50 i believe its called. there is 2 different courses. This is part 1 of 2. This is how i learned how to code in python. Very good courses. Really get your mind thinking in a programmatic way as opposed to some of the other introductory options out there.

  37. Thanks to MIT for this great content! However I'd like to just point out that Professor Grimson makes several politically-biased remarks throughout the lecture, and to me it seems inappropriate for a course on computer science to include political remarks, even if in jest. This gives further credence to the criticism that higher learning institutions are dominated by progressive partisans.

  38. 'aaah' I need the loop someway to walk in through them : Great job I always wanted to understand the theory under the surface

Leave a Reply

Your email address will not be published. Required fields are marked *