Lec 3 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • Lecture 3: Common code patterns: iterative programs
    Instructors: Prof. Eric Grimson, Prof. John Guttag
    View the complete course at: ocw.mit.edu/6-00F08
    License: Creative Commons BY-NC-SA
    More information at ocw.mit.edu/terms
    More courses at ocw.mit.edu

ความคิดเห็น • 319

  • @GeorgeDaramouskas
    @GeorgeDaramouskas 10 ปีที่แล้ว +109

    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 :D

  • @monsta0927
    @monsta0927 14 ปีที่แล้ว +9

    Professors in MIT really know how to teach people.
    Even a non-english programmer like me in Taiwan still understand what they are teaching and enjoy the online courses so much~
    MIT OpenCourse rocks~

  • @Younessss_
    @Younessss_ 4 ปีที่แล้ว +23

    i love his dad jokes and friendly way of teaching

  • @jayhoeliotdecabrio4050
    @jayhoeliotdecabrio4050 4 ปีที่แล้ว +8

    Give him award for one of the best teacher

  • @bluevette1978
    @bluevette1978 11 ปีที่แล้ว +5

    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!

  • @Kondwani_simwanza
    @Kondwani_simwanza 2 ปีที่แล้ว +1

    Thank you MIT for helping me become a good programmer

  • @cityvoyage
    @cityvoyage 10 ปีที่แล้ว +13

    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.

  • @donkameron6845
    @donkameron6845 3 ปีที่แล้ว

    I love the sweet " :) Good morning" written on the board! Really makes you feel at home, even if I am watching this hundreds of km and a couple of years away!

  • @brokemalone7011
    @brokemalone7011 6 ปีที่แล้ว +1

    I have tried learning programming 4 times in the past. It FINALLY clicked! Thank you!

  • @SsikG
    @SsikG 12 ปีที่แล้ว +9

    im so grateful for MIT uploading such valuable lectures! Thank you so much

  • @RU-qv3jl
    @RU-qv3jl 2 ปีที่แล้ว

    So the lecturers where I went to uni put me off coding for decades. You guys are making it really nice and easy, thanks.

  • @theonetrueac
    @theonetrueac 12 ปีที่แล้ว +1

    I want to thank MIT for providing these lectures and the lecturers for them allowing it to be done. Given the chance I would have attended MIT specializing in software engineering, but since I could not, this is almost like being in the classroom.

  • @WilsonLee123
    @WilsonLee123 3 ปีที่แล้ว +1

    Jesus guys, he's not THAT funny.
    It's amazing that we can re live this whole course for free. What a time to be alive.

  • @LucasMelin
    @LucasMelin 15 ปีที่แล้ว +16

    The flowchart is a good idea. It really helps to visualize your program. In koffice (ubuntu), there's a decent flowchart program called Kivio if anyone is trying to find one.

    • @walmikgondane8744
      @walmikgondane8744 หลายเดือนก่อน

      6:14 mmmlpl
      Lpppl
      L
      Llllll
      Lop l
      Plppp
      P
      P
      P
      P

  • @rakeshyogendran6410
    @rakeshyogendran6410 3 ปีที่แล้ว +2

    Great teachers make great institutions. Thanks for the videos MIT!!

  • @zeus_offiziell
    @zeus_offiziell 13 ปีที่แล้ว +3

    I`m currently taking Intro Programming Logic and we are doing flowchart strucuture and I find it quite easy and Interesting!! LOVE MIT!

  • @chucksnelling9417
    @chucksnelling9417 11 ปีที่แล้ว +4

    THANK YOU MIT!!!! This is an AWESOME resource!

  • @vivauruguay
    @vivauruguay 12 ปีที่แล้ว +1

    WE NEED MORE TEACHERS LIKE THIS
    KEEP UP THE GOOD WORK

  • @brandisgrier2845
    @brandisgrier2845 10 ปีที่แล้ว +7

    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.

  • @dacoup5955
    @dacoup5955 9 ปีที่แล้ว +15

    I'm sorry but the comment on keeping nerds in a museum had me cracking up .. Keep em coming!!

  • @chucksnelling9417
    @chucksnelling9417 11 ปีที่แล้ว

    This is probably the best resource I have ever found on the net. I wish all of the schools that offer "Online classes" would provide this type of instruction instead of a guided self study course which is basically all it is. I have learned more in 1 day here than in $13,000 worth of Online Classes...

  • @nsartigo
    @nsartigo 10 ปีที่แล้ว +2

    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'?

  • @cmdargument
    @cmdargument 13 ปีที่แล้ว

    gonna watch them all. Thanks MIT

  • @christianangulo5850
    @christianangulo5850 8 ปีที่แล้ว +1

    hahah John is alive. Prof Eric thanks for such a great class not bad for a couple years old .

  • @sbarter
    @sbarter 5 ปีที่แล้ว +2

    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.

  • @xemoable
    @xemoable 9 ปีที่แล้ว +17

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

    • @yangwang24
      @yangwang24 9 ปีที่แล้ว

      osama ibrahim thx a lot.

    • @laniakea1501
      @laniakea1501 8 ปีที่แล้ว

      thanks

    • @laniakea1501
      @laniakea1501 8 ปีที่แล้ว

      thanks

    • @lukerengel8533
      @lukerengel8533 7 ปีที่แล้ว

      Actually you should you should have that in a formatted print statement so you don't have to worry about spaces and it looks cleaner
      -string concatenation is a bad habit to learn because once you start programming larger apps it won't scale as well as using joins or string formatting
      ie: print ({} is a divisor of {}).format(i, x)

    • @tristanmisko
      @tristanmisko 6 ปีที่แล้ว

      you are my hero

  • @imegatrone
    @imegatrone 12 ปีที่แล้ว

    after i watched this video Common code patterns: iterative programs, my insight is very open because the video is very good to give information

  • @gpjapan
    @gpjapan 7 ปีที่แล้ว

    Thank you for your helpful and charming lecture.

  • @adiflorense1477
    @adiflorense1477 3 ปีที่แล้ว

    Thank you sir. I can understand the algorithm and data structure from you

  • @sunner008
    @sunner008 7 ปีที่แล้ว

    It's very useful, I like this course very much.

  • @erensatik
    @erensatik 2 ปีที่แล้ว

    This lectures are real tresure.

  • @nigelanicette9243
    @nigelanicette9243 2 ปีที่แล้ว +1

    This is the 3rd lecture I heard. I found it interesting. Perfect squares are just the result of multiplying 2 exact numbers, to form 1 number. For example, 25 is a perfect square because 5 * 5=25. I'm 3 lectures in. I'll hear all his lectures and see what happens for me.

  • @jasonsprouse3337
    @jasonsprouse3337 8 ปีที่แล้ว

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

  • @MrPatrickDayKennedy
    @MrPatrickDayKennedy 9 ปีที่แล้ว +18

    "...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!

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 ปีที่แล้ว +1

      I sure wish I'd watched this before attacking the prime numbers homework assignment... all in all though I'm glad I didn't cuz it really stretched my brain some to wrangle a solution :)

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 ปีที่แล้ว +1

      Ah - hey, whaddya know? The class handouts are also available at the MIT parent site! U ROCK MIT!

  • @asmartbajan
    @asmartbajan 11 ปีที่แล้ว

    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.

  • @norbi4148
    @norbi4148 7 ปีที่แล้ว +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...

    • @oliverludwig6148
      @oliverludwig6148 4 ปีที่แล้ว +3

      well, sherlock, do you think people start with the last lecture? even if every viewer sticks to the end, the count for the 1st lecture will always be higher than for the last one.

    • @unholychowders
      @unholychowders 4 ปีที่แล้ว +12

      3.5 million (using the outdated statistics) people want to learn computer science. Only a fraction of them are willing to actually do the *learning* part. That's fine in principle, but there's a massive problem when these same people have the habit of quitting the moment a little effort may be required.
      Everyone wants to win the marathon, but nobody's willing to run. Don't be your own worst enemy and keep yourself at the starting point. Very often it is the individual who oppresses themself the worst. Don't guarantee yourself the position of last place.

    • @TarotReaderASMR
      @TarotReaderASMR 3 ปีที่แล้ว

      also, more and more empty seats

    • @mao4859
      @mao4859 2 ปีที่แล้ว

      @@unholychowders 👍

  • @svieczorek
    @svieczorek 14 ปีที่แล้ว

    Ok,
    I plan to follow the course through and will look int c++ after. Thanks for responding.

  • @biggapoww
    @biggapoww 7 ปีที่แล้ว

    Love the lecture very wonderful

  • @Amitstylenfitness
    @Amitstylenfitness 5 ปีที่แล้ว

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

  • @complexPHILOSOPHY
    @complexPHILOSOPHY 11 ปีที่แล้ว +1

    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.

  • @seanslingshot
    @seanslingshot 10 ปีที่แล้ว +23

    Noticing how much lower the views are from the beginning... That's just sad.

    • @theilluminedone7896
      @theilluminedone7896 8 ปีที่แล้ว +5

      +T3chnical R3dn3ck This stuff isn't for everyone.

    • @Noldy__
      @Noldy__ 7 ปีที่แล้ว +1

      lol, noticed that too. Still hanging

    • @milly4543
      @milly4543 7 ปีที่แล้ว +12

      some people just click on the first one to see what it's about, not because they want to actually study it.. also a lot of people will transition to the ocw site

    • @ChernobylPizza
      @ChernobylPizza 5 ปีที่แล้ว +7

      Some of us already know all this stuff but we are just curious what CS101 is like at MIT

    • @iananddani
      @iananddani 4 ปีที่แล้ว

      it's just not for everyone. lol.

  • @francismusic1984
    @francismusic1984 11 ปีที่แล้ว +1

    thanks for this, hope some day I can study at MIT

  • @specialk22tt
    @specialk22tt 11 ปีที่แล้ว +1

    To do this, you'd use a method in Python.
    x = '1952'
    print len(x)
    When run, it gives you 4.

  • @Goodborni
    @Goodborni 11 ปีที่แล้ว

    I love and would like to thank MIT for this, it's the only good source that I actually can use to learn Programing.
    PS. For some strange reason (maybe different Python version), I get 'purple' print word, but it yet works flawlessly it's just strange...

  • @surfpub2001
    @surfpub2001 14 ปีที่แล้ว

    SO after making corrections for parenthesis, what was the last problem that must be fixed in order to avoid typeError: can only concatenate tuple (not "int") to tuple. [Time 44 minute]

  • @khairunisasarguroh7467
    @khairunisasarguroh7467 3 ปีที่แล้ว

    Excellent

  • @eliodagostini
    @eliodagostini 7 ปีที่แล้ว

    this guy is awesome

  • @specialk22tt
    @specialk22tt 11 ปีที่แล้ว

    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.

  • @RSPSify
    @RSPSify 11 ปีที่แล้ว

    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? :)

  • @klavsrenerts4826
    @klavsrenerts4826 10 ปีที่แล้ว +32

    He has awesome humor, what's wrong with the students over there? :D

    • @aditi327
      @aditi327 4 ปีที่แล้ว +3

      They just want to score marks I guess

    • @nellsawere
      @nellsawere 4 ปีที่แล้ว +4

      MIT, not sure if personality is part of a typical MIT student’s personality

    • @ahmedhussein4297
      @ahmedhussein4297 2 ปีที่แล้ว

      MIT student didn't laugh so much i think !🙋

    • @michaelangelos5117
      @michaelangelos5117 2 ปีที่แล้ว +1

      There's no laughing in computer science.

  • @choonghuh
    @choonghuh 13 ปีที่แล้ว

    @Shpira He added a comma after i. So, the tuple (i) in the line divisors = divisors + (i) became (i,)

  • @scorpionismification
    @scorpionismification 12 ปีที่แล้ว

    Can any one tell me what program he is using to write the codes? I downloaded python and it doesn't seem to have the "run" function as in this video. Is it so because python is an interpreter and not compiler? thanks

  • @kristinepetrosyan2125
    @kristinepetrosyan2125 9 ปีที่แล้ว

    Thanks for your videos!!! Could please help to find homework assignments and exercises concerning the topic. Thanks!

  • @mrzipdisk
    @mrzipdisk 14 ปีที่แล้ว

    What changes does the prof make at 43:20? I can't see what he did.

  • @acko741
    @acko741 13 ปีที่แล้ว

    what does he throws to whom answer the questions he makes?

  • @tankj51
    @tankj51 11 ปีที่แล้ว +1

    Wherr can I find problem sets?

  • @tileformiles
    @tileformiles 11 ปีที่แล้ว

    But what WOULD the code look like to add up the # of digits? (that's what I was trying to do)

  • @snowyx10mini
    @snowyx10mini 9 ปีที่แล้ว

    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

    • @huiliantay791
      @huiliantay791 9 ปีที่แล้ว

      attyfarbuckle thank you!

  • @danedaworld
    @danedaworld 14 ปีที่แล้ว

    if you look at their website, and go to the problem sets for homework, it tells you to solve for prime numbers. can you help me create a formula to find the 10000th prime?

  • @phatsk8r420
    @phatsk8r420 13 ปีที่แล้ว

    AWWW THIS IS AWEsOME!!!

  • @PlazadeArmasHostel
    @PlazadeArmasHostel 9 ปีที่แล้ว +25

    the camera guy wasn´t learning at all

  • @felixluo8111
    @felixluo8111 6 ปีที่แล้ว

    so s1 and s2 is a string or tuple?

  • @bluebird23456
    @bluebird23456 11 ปีที่แล้ว

    can anyone help me with the problem he assigned last time? I don't understand the code to find the prime number? It is an equation that computes the variable?

  • @orochinagi1111
    @orochinagi1111 11 ปีที่แล้ว

    why?
    a) Concepts of tuples and lists form the very basis of python
    b) After being corrected by a student his reaction is even more puzzled:
    "ooh so youre saying that I want this(parenthesis) and not this(square bracket)?...Is that right John? Yes? Okay sorry.."
    Nobody can know everything 100% of the time but this is like teaching a course on english and not knowing where to use commas.Like I said, I like his teaching style--it is engaging. And huge thanks to MIT for providing these lecture!

  • @disc2wo
    @disc2wo 13 ปีที่แล้ว

    A world of privilege. see how far one must go just to get a decent lecture. if only opportunity were universal.

  • @mjconley
    @mjconley 12 ปีที่แล้ว

    thanks DnNdr and Levercode

  • @JohnPopovsky
    @JohnPopovsky 12 ปีที่แล้ว

    well done thank you !!!

  • @joefnmarchese
    @joefnmarchese 9 ปีที่แล้ว +33

    9:57 Demon Cam

    • @lFataI1ty
      @lFataI1ty 6 ปีที่แล้ว

      3 spooky 5 me

  • @radilim
    @radilim 13 ปีที่แล้ว

    @Anorrea Thank you for this one :)

  • @jmannii
    @jmannii 13 ปีที่แล้ว

    I am getting an MIT education for free. I'm thankful for this opportunity.

  • @asabeneh
    @asabeneh 10 ปีที่แล้ว

    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("-------")

  • @scorpionismification
    @scorpionismification 12 ปีที่แล้ว

    @xejerk and @SandroidHD: Thank you for replying! I have Windows and I use Python IDLE (GUI) but it doesn't have the "run" function. The problem is, unlike in eclipse (in java), I can not go back and make changes in the code in Python IDLE.

  • @mrfwest
    @mrfwest 12 ปีที่แล้ว

    are you talking about the uk version of college or US version of college

  • @copecrew2000
    @copecrew2000 11 ปีที่แล้ว

    Good theory...need to do the homework and have a reason to learn it.

  • @scorpionismification
    @scorpionismification 12 ปีที่แล้ว

    @xejerk thanks again! this is exactly what i was looking for. cheers!

  • @OlubukolaLaditan
    @OlubukolaLaditan 13 ปีที่แล้ว

    code @ 43:12 does not work for me. even after I added (i,). why?

  • @faiqarif5765
    @faiqarif5765 5 ปีที่แล้ว

    Can I find anywhere problem sets/assignments related to this course? Thanks

    • @mitocw
      @mitocw  5 ปีที่แล้ว +1

      See the course on MIT OpenCourseWare to see the full course materials: ocw.mit.edu/6-00F08. We also recommend you checkout the Scholar version of this course at: ocw.mit.edu/6-00SCS11. It has more materials that might be of help. Best wishes on your studies!

  • @StarCrafterCJ
    @StarCrafterCJ 11 ปีที่แล้ว

    AMAZING

  • @blazinghellwheels
    @blazinghellwheels 12 ปีที่แล้ว

    I Thank MIT for these lectures and I learned a lot from these lectures so far, just wondering who this john guy is

  • @mrfwest
    @mrfwest 12 ปีที่แล้ว

    i look it up secondary school in the Uk it says its about 10-16 if thats what high school there, then were talking about two different things because 11 years old in the US is about 5 or 6 grade. which is about 3-4 year gap from high school 14 to about 18.
    schools in the US is divide maturity levels (i think)

  • @Blade0047
    @Blade0047 11 ปีที่แล้ว

    It is possible to get the Homework assignments?

  • @complexPHILOSOPHY
    @complexPHILOSOPHY 11 ปีที่แล้ว

    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.

  • @nirajmallaioe
    @nirajmallaioe 7 ปีที่แล้ว

    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'

    • @nirajmallaioe
      @nirajmallaioe 7 ปีที่แล้ว

      Thanks Jeremy I already found it !!! :)

  • @nsartigo
    @nsartigo 11 ปีที่แล้ว

    Im in a sixth form college is that the same as high school or is it one level higher (im 17 btw)

  • @harshchoudhary1606
    @harshchoudhary1606 3 ปีที่แล้ว

    Seriously its encourages me to join mit ,harvard,and foreign university

  • @englandandwalescricketupda214
    @englandandwalescricketupda214 5 ปีที่แล้ว

    Nice sir. .

  • @wuapricot9100
    @wuapricot9100 11 ปีที่แล้ว

    Are we supposed to understand how to read and write basic codes after the past 3 lectures. if so im behind :/

  • @alternapop
    @alternapop 13 ปีที่แล้ว

    @anidude98 for handouts go to MIT's site (search google for this course). the handouts are under "videos", then "related resources"

  • @car_ventures
    @car_ventures 7 ปีที่แล้ว

    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...

    • @CyanOgilvie
      @CyanOgilvie 7 ปีที่แล้ว +2

      The number 1952 is converted to a string containing 4 characters: "1", "9", "5" and "2", in order. This is what the str(1952) bit is doing. This is then presented to the for loop as the ordered set to iterate over, and on each iteration the variable c contains the element from the set being iterated over, starting with the first ("1") and proceeding in order through the set until all the elements are exhausted. So on the first iteration, the variable c will contain the character "1" (not the number 1, but the "letter" "1", which is codepoint 49 if ascii or unicode is the character set in use). The int(c) in the body of the for loop scans the characters of the string it is given and converts them to the number those digits represent (provided they don't contain characters that aren't a valid string representation of a number, so int('42') is ok, int('hello') is an error). Then this numeric value is accumulated in the variable sumDigits (which therefore takes on the values 0, 1, 10, 15, 17 as the loops proceed). This accumulator is then printed out

    • @car_ventures
      @car_ventures 7 ปีที่แล้ว

      Thanks Cyan, i think that's more sense now :) Thanks for explaining

  • @AnAwesomePerson1000
    @AnAwesomePerson1000 11 ปีที่แล้ว

    Have you done the homework assignments?

  • @christalkarat
    @christalkarat 11 ปีที่แล้ว

    I could watch it before,but now?
    Do I have to donate the money first to watch it again ?

  • @marconatrix
    @marconatrix 12 ปีที่แล้ว

    I went to a highschool at age 11 as did everyone else in my town. It was even called a 'high school' although the normal UK term is 'secondary school'.

  • @codygman91
    @codygman91 14 ปีที่แล้ว

    I was glad someone corrected him about the list and tuple syntax. I bet he would have figured it out a bit later though, or John would have corrected him.

  • @jrwkc
    @jrwkc 14 ปีที่แล้ว

    @EKBadass hey EK, this is just any old text editor. Say for instance you type many lines of code into your shell. But instead of typing that in every time you can save all the code in a text file. Then when you run the text file in python, you will get back the interpreter with some output (if you specified some output in the code). So he has a text editor open (in this case IDLE) where he is saving lines of code you would of had to type over and over again.

  • @pasinduweerasinghe7659
    @pasinduweerasinghe7659 7 ปีที่แล้ว

    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?

    • @delvinc822
      @delvinc822 7 ปีที่แล้ว +2

      athletics and community work, also a letter of recommendation from someone in the faculty at MIT.

  • @ahmedtarek9314
    @ahmedtarek9314 10 ปีที่แล้ว

    i don't have the area that he writes his code in ... i write and execute in the same time in straight line !!

  • @surojdey312
    @surojdey312 6 ปีที่แล้ว

    Which programming language was being used for this course?

    • @mitocw
      @mitocw  6 ปีที่แล้ว

      This course uses Python 2.5.x. See the course on MIT OpenCourseWare for more details at: ocw.mit.edu/6-00F08.

  • @danedaworld
    @danedaworld 14 ปีที่แล้ว

    can someone help me with problem set number 2?

  • @mahmoudkishtaa
    @mahmoudkishtaa 13 ปีที่แล้ว

    he is the best ;)

  • @damonleo8011
    @damonleo8011 10 ปีที่แล้ว

    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?

    • @joshabernathy972
      @joshabernathy972 10 ปีที่แล้ว +2

      That is correct, the line of code should be
      divisors = divisors + (I,)
      Meaning it's adding the desired elements(specified by the if statement) to the variable "devisors"(which starts out as an empty tuple and gets elements added to it)
      If this doesn't help, elaborate on your problem a bit more so I can try to help you.

    • @kethusingh6186
      @kethusingh6186 8 ปีที่แล้ว

      +Josh “DimeADuzen” Abernathy
      x = 100
      divisors = ()
      for i in range(1,x):
      if x%i == 0:
      divisors = divisors + (i,)
      --returns no value
      -i'm using python 3.5.1

    • @manukumarshetty2753
      @manukumarshetty2753 6 ปีที่แล้ว

      x=100
      divisors =()
      for i in range(1,x):
      if x%i==0:
      divisors=divisors+(i,)
      print (divisors)