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

Поделиться
HTML-код
  • Опубликовано: 18 дек 2024

Комментарии • 741

  • @getellied
    @getellied 5 лет назад +199

    Absolutely love this professor's method of teaching! It is very well explained! (As I would expect from an MIT professor.)
    Also, thank you, MIT, for the free knowledge. It is very important!
    Just as an FYI, these lectures feature older versions of Python, so there are a couple of differences (as far as what I can think of right now and are plausible to what he is teaching): (BTW these only apply to Python, not all programming languages; each one have their own set of syntax rules.)
    - The '/' operator now provides real solutions (e.g. 9/5 is 1.8). It seems to convert the VARIABLE into float automatically - you can check that by assigning a division to a variable (as an example, [value = 9/5]) then typing the command [type(variable)] (in my case, [type(value)]) and it will give out "float".
    It will not do that, however, if you use the operator "//", which is an integer division - the variable will be set as the int type (integer);
    - You CANNOT compare a string with a number anymore: it now gives out the expected TypeError;
    - Print statement goes with parenthesis now. Should be [print('statement')], not [print 'statement'] - it will give out SyntaxError without the parenthesis.
    - 'raw_input()' has been changed to 'input()' and the original 'input()' does not exist anymore. Source with more details found on stackoverflow.
    - 'while' loops do not take parenthesis anymore - they are not needed. However, no error message will be given out (taking base from Python 3.7). This also applies to 'if' statements.
    Again, thank you MIT for the awesome lectures! And thank you, reader, for paying any attention to my comment! :)

    • @harshsheth912
      @harshsheth912 4 года назад +3

      Thanks Daniel for updating us with new information.

    • @imserdar
      @imserdar 4 года назад +1

      Thank you Daniel for very useful information 👍🏼

    • @theadel8591
      @theadel8591 3 года назад

      So is learning the language in this course outdated ?

    • @getellied
      @getellied 3 года назад +5

      @@theadel8591 TLDR: No, not at all! Most of what the course covers includes the key features newer versions still have as well.
      Python is such a nice language that, while the versions are different and there are improvements/modifications, the versions are similar enough that it is still an incredible course.
      However, very important to note that, depending on your usage, it is good that you learn both this version and newer ones - there are companies, as an example, that still uses Python 2 for their software.
      In any case, if you learn from this course, you'll find it is way easier to learn the differences later and it will not be hard to adapt your code.
      Hope this responded - if not, please comment again and I'll be sure to answer! :D

    • @theadel8591
      @theadel8591 3 года назад +1

      @@getellied thanks Danielle, i’m now more confident in the time and effort I’ll put into this course.

  • @christianangulo5850
    @christianangulo5850 8 лет назад +503

    this is so cool, I am taking MIT computer science lectures for free. love this era. good class sir.

  • @diaryoflife2024
    @diaryoflife2024 4 года назад +22

    So far I've found and have taken one entire course from the University of Toronto by Dr. Jordan Peterson and now working on the Harvard CS50 and this MIT 6.00 lecture; if a person doesn't educate themselves it's due to their own choice, the resources available now are limitless. You can ask all of my notebooks, I take notes for every class and ensure a good night's sleep after that lecture and lab, so far that's been my recipe for moving data from short term to long term memory. Thank you @MIT for making these available to the public, I'm truly grateful.

    • @semtex6412
      @semtex6412 4 года назад +1

      how far along are you now? these videos are out of date. :(

    • @atlas.heart.O
      @atlas.heart.O Год назад

      Hey ? If you ever see that and still have them i would be happy to have your notes ! (And what about you now :)?)

    • @channelname8623
      @channelname8623 Год назад

      did you say you have notes? and do you use anki?

  • @043mehdi
    @043mehdi 6 лет назад +130

    Had no idea during 2009 that MIT was uploading there class lectures like this. All I did during 2009 was watching music videos in youtube.

  • @shizyninjarocks
    @shizyninjarocks 8 лет назад +168

    Free education rocks!

    • @christoandries7117
      @christoandries7117 6 лет назад

      shizyninjarocks free power

    • @Colonies_Dev
      @Colonies_Dev 5 лет назад

      awesome but i wished they had better quality so i could read the code in full screen xD

    • @Ahuratum
      @Ahuratum 4 года назад

      Amar Hajdarević yes, we are, but they received a highly accredited degree.....if they passed the class, that is.

  • @elektrosoundwave
    @elektrosoundwave 10 лет назад +82

    Could you pass along my thanks to the professors and whoever came up with this idea. These videos are a Godsend for someone who has to repeat segments over and over again due to an extreme case of ADHD. I could not sit through an actual class and get this without my mind wandering across any and every other possible subject.

  • @kxmode
    @kxmode 10 лет назад +87

    I like how this teacher is humble enough to admit a mistake

  • @JacklynCunningham
    @JacklynCunningham 9 лет назад +27

    I love these, it don't like my prof he's not very effective at teaching this stuff, i have no background in computer science and my first day my prof went into so much stuff and i have no idea what he was talking about but I'm learning alot from these videos!!

  • @kaspa123321
    @kaspa123321 8 лет назад +138

    i swear this guy and john are like best friends. He refers to this guy every other minute lol

    • @12theunknown12
      @12theunknown12 8 лет назад +35

      plot twist, he's his imaginary friend.

    • @ownSystem
      @ownSystem 4 года назад +1

      Johns like. He pays me to stay here. 😂

    • @Michael-xb5zq
      @Michael-xb5zq 3 года назад +1

      theyre secret lovers

  • @kervensjasmin1508
    @kervensjasmin1508 7 лет назад +96

    Views drop off each proceeding lecture. That shows the extent to which some are willing to commit to a path.

    • @CottonCookie
      @CottonCookie 6 лет назад +3

      lmao true! They can't appreciate the beauty of free education

    • @phriesen
      @phriesen 6 лет назад +7

      A phenomenal discovery.. please have your findings published.

    • @lalaithan
      @lalaithan 5 лет назад +17

      Self-discipline is no easy thing. Hard work pays off.

    • @DarthScosha
      @DarthScosha 5 лет назад +9

      This happens in real life at universities also. The first lectures are a deluge of people queuing 10 minutes early, eager for those doors to open. By mid term a third of the seats are empty and people are walking in 5 and 10 minutes late.

    • @semtex6412
      @semtex6412 4 года назад +5

      ease off with the judgements. there could be a lot of reasons. they might have found better resources, schools, materials, etc. MIT's OCW isn't the only high quality resource available. or they could have moved to a new place where access to youtube or any OCW is restricted, they could have gotten killed etc.
      one thing's for sure tho - we don't know shit about them.

  • @tjkoker
    @tjkoker 4 года назад +1

    Professor Grimson is an "off the hook" orator. He breaks down programming in a way that allows even the thickest of students to understand the subject matter and make educated decisions. Kudos for teaching in Python. It is a powerful language but closest to "easy" that you can get in programming. Well done, Gents. Cheers.

  • @materialknight
    @materialknight 4 года назад +5

    10:54 They seem to have taken the feedback, since in Python 3.8 this is no longer possible; it will no longer assume you want to compare the value expressed by the string if the other parameter is not also a string. In other words: If both are numbers, or if both are strings, it WILL compare their value, but if one is a number and the other a string, it will throw an error message.

  • @86Calikidd
    @86Calikidd 7 лет назад +188

    No excuse for not expanding your mind nowadays.
    *fixed

  • @AhmedHassan-cj8yi
    @AhmedHassan-cj8yi 5 лет назад +3

    I start college this fall and I am already being taught by an MIT professor on programming can’t get better than this.

  • @j0esene
    @j0esene 8 лет назад +23

    I'm new to programmin and i felt in love with Python the second i ran it, and i never tried to program before. But it was kinda hard to find a lecture or tutorial as good as this OCW. I always dreamed of e going to MIT, but being brazilian never helped, but now i can at least have a lil taste of it.

  • @gainup1
    @gainup1 15 лет назад +1

    I am in college right now and am taking this class (of course not at MIT), these videos help sooooooo much. I am glad they started this.

  • @natepowley
    @natepowley 6 лет назад +17

    7:05 you get to see JOHN, OMG HE IS A ACTUAL PERSON

    • @darylrobins4097
      @darylrobins4097 4 года назад +2

      Somebody didn't fully watch lecture 1 ;) we saw him there too

  • @christalkarat
    @christalkarat 11 лет назад +1

    Thank you for these VDO. It helps to undetstand more about coding and programing for me, a person does not know anything about coding,but only languages for my living. Please keep this good work on. I love this professor and his lecture.

  • @NorbuEbenezerTamang98
    @NorbuEbenezerTamang98 4 года назад +1

    Thank you so much uploading these lectures for free. May God bless the MIT more and more. Prof. Eric Grimson is teaching great!! Loved it !!

  • @bkroberts89
    @bkroberts89 13 лет назад +3

    Excellent professor. He explains everything with precision and clarity. I wish my programming professor was like this man. If you're having trouble try Bucky's tutorials for additional clarity. Definite subscribe.

  • @EverlycatsRoblox15
    @EverlycatsRoblox15 13 лет назад +2

    i love how he teaches some how he doesn't make the lecture boring

  • @flipbooks56
    @flipbooks56 11 лет назад +3

    Most important with employers are the following: 1) Can you follow a routine for long periods of time (years) ? 2.) Can you complete a task that you've started ? 3.) Can you work under the pressure of a schedule ? 4.) Can you work within the system, as opposed to doing it your own way? 5.)How do I know, BEFORE I hire you, that you have the skills you say you have? 6.) Is there some way I can verify that your skills have been tested ? 7.)

  • @anidude98
    @anidude98 13 лет назад +1

    i love this. if i were an older person taking this course and knowing that my ENTIRE FUTURE in programming, i would be too scared and fail. but because im a 7th grader in a very free-flowing home-school program in which watching RUclips means my teacher is in LOVE with me, i get to pay attention, pause, play around with software in the middle of class and alot of other stuff.
    the only thing i dont love is that i cant ask HIM a question.

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 6 лет назад +10

    Thanks to the MIT, Eric and John for this excelent course.

  • @indigoanon5483
    @indigoanon5483 11 лет назад +34

    “You blew 150k on an education you could have gotten for a $1.50 in late fees from the public library.” Good Will Hunting

    • @alekhine129
      @alekhine129 4 года назад +4

      @@RandomRUclips123 If everybody thought that was the sole benefit, these courses would not exist.

    • @TheSelfHelpTube
      @TheSelfHelpTube 3 года назад +1

      That Will Hunting was one of the dumbest folks ever to be seen on the silver screen.

  • @chucksnelling9417
    @chucksnelling9417 11 лет назад +2

    This is awesome!!!! Learning more here than semesters in "Online Colleges" Thank you for making this available!!!!

  • @boxpilot643
    @boxpilot643 13 лет назад +2

    i personally want to thank professor jim ericson for delivery such interesting lectures

  • @joeverzino
    @joeverzino 9 лет назад +3

    Your tutorials are absolutely excellent for beginners.

  • @TheBaldhippy
    @TheBaldhippy 14 лет назад +1

    Thanks for this, everyone involved! I am currently on lecture 6 but I find it interesting how the number of views for each lecture goes down as the lecture number goes up.

  • @umeithou
    @umeithou 15 лет назад +1

    Thank you. I should have remembered that from intro to Linux. I definitely remembered how important attention to detail is with Linux.
    This open source education is probably the greatest discovery since the internet itself.

  • @pradeenkrishnag2368
    @pradeenkrishnag2368 2 года назад

    49:21 it won't go into an infinite loop. The result will be 0 since the while loop is skipped because -4 is smaller than 0 and outputs the value of Y, which is 0.

  • @setotitan
    @setotitan 13 лет назад +1

    He has such a great way about laying things out logically so they are easy to understand.

  • @cezariusus7595
    @cezariusus7595 2 года назад

    Props to MIT for making this free. All human knowledge should be free.

  • @imegatrone
    @imegatrone 13 лет назад +1

    after i watched this video Operators and operands; statements; branching, conditionals, and iteration, my insight is very open because the video is very good to give information

  • @pkpkgr
    @pkpkgr 14 лет назад +1

    great opportunity to watch fascinating lectures from a prestigious university.

  • @hung4hair
    @hung4hair 9 лет назад +11

    @13:10, when professor answers the student's question, his statement "under ASCII encoding, the numbers are going to appear after the characters (alphabets?)" is incorrect. In ASCII encoding the numbers come before the alphabets. The reason why 4 < '3' is "True" is because the value of '3' in ASCII is 50 in decimal. So (decimal 4) < (decimal 50) is True. As the professor indicated, python has an issue where it allows mixing of types and is the reason for confusions.

    • @avijeetjha8774
      @avijeetjha8774 7 лет назад

      Adam Adam 1-how do we know when has a block ended coz at 37.12 the output said mom and not hello although both hello and mom print statements were written consecutively without anything in between.
      2-the integers are not assigned to variables rather the variables just get bound to the number which pre existed somewhere then does the same hold true for strings also coz it would have had been a daunting task for the developer to create all combinations of words and sentences that can be made with 26 alphabets which can then be bound to the variables.

  • @r.d.machinery3749
    @r.d.machinery3749 5 лет назад +1

    18:06 X does not point to the value 15 stored in memory. It is completely incorrect to imagine that x points to it. It is much more accurate to think of x as a box into which the value 15 is copied.

  • @darylrobins4097
    @darylrobins4097 4 года назад +1

    Loving these lectures and learning so much, like Eric says "while" like his safe word is whiskey in Hot Rod.

  • @coolioschmoolio1
    @coolioschmoolio1 12 лет назад +1

    instead of doing str(10) with your number inside the parameters, you can also contain your number with back-ticks `10` and it will consider the number a string.

  • @Dabket3araB
    @Dabket3araB 9 лет назад +115

    I was giving myself candy every time he asked a question and I was able to answer it. Hersey's kisses with almonds to be clear.

  • @michaelcoonce6412
    @michaelcoonce6412 7 лет назад +1

    Had to say thank you for these. They've been priceless to me.

  • @KevinBond2663
    @KevinBond2663 10 лет назад +1

    Thank you, Prof. Grimson and MIT for a great video.

  • @kevinkiesel4937
    @kevinkiesel4937 11 лет назад +1

    I am enjoying these videos, they are a great way to learn more besides what I study already, goes great with what we are learning in my class

  • @joeverzino
    @joeverzino 9 лет назад +4

    I believe the explanation that says 15 is stored in memory and three values point to it is in error. I have programmed in binary, assembler and all the way to ADA [BOO!].
    I believe there are 3 variables all containing the number 15. I would be interested in heraing your response response

  • @cornelxbox25
    @cornelxbox25 8 лет назад +2

    Thank you for the amazing lectures.
    In the newer version (3.6.0) to check an integer if it's even or odd I did the following:
    x=15
    if (x%2==0):
    print ('Even')
    else: print ('Odd')

    • @dg_dotnet9616
      @dg_dotnet9616 3 года назад

      So true.
      I did it like in the video and I got even has result .. so i believe doesn't work the same way on newer versions o python

    • @walterbryan4365
      @walterbryan4365 3 года назад

      Thank you. I was really scratching my head over this since (x/2) * 2 can work for both odd and even numbers.

  • @TomboyCactus101
    @TomboyCactus101 12 лет назад +3

    Thanks Goodness for the subtitles, they really help. :)

  • @labasl
    @labasl 15 лет назад +1

    He is quite interesting teacher. Of course, lessons should be viewed several times. He is much more better that the next one, who were lazy even to learn what he is teaching (always looks to notes on next lessons). Will see, how these lessons will learn me Python.

  • @racorker
    @racorker 8 лет назад +3

    thank you for this MIT. Big kudos to you

  • @adityapasari2548
    @adityapasari2548 8 лет назад +25

    2/24 . Let's see how far I can go :P . Learning this to study Machine Learning.

    • @jordantan2543
      @jordantan2543 8 лет назад +1

      great, going to learn machine learning myself too! But isn't maths more important for that purpose? I am not sure

    • @adityapasari2548
      @adityapasari2548 8 лет назад +4

      I am going to see videos on Linear algebra by Gilbert Strang and Harvard Statistics 110 video series too during the winter break. I think these are the most important math topics for ML.

    • @Unstable_Diffusion89
      @Unstable_Diffusion89 7 лет назад +2

      How is the Machine Learning learning(lol) going?

    • @TheRayll
      @TheRayll 7 лет назад +2

      so did it happen?

    • @semtex6412
      @semtex6412 4 года назад

      @Aditya how far along are you now?

  • @sadnessinmylife
    @sadnessinmylife 11 лет назад +1

    Yes, in Python 3.x it is flipped, to get 3/5 = 0 in Python 3, you have to use double forwards slash: Python 3: 3//5 = 0, Python 2: 3/5 = 0

  • @mattelabsg7813
    @mattelabsg7813 6 лет назад +1

    definitely love his classes... How i hope i get to see whats in their handout

  • @jimmysjamin1
    @jimmysjamin1 6 лет назад +1

    Woe this is very amazing and interesting very intricate and dyammmmm it's free this is so thuro ! This is way better teaching that I have ever had the pleasure of listening to thankyou so much for the time and generosity involved in Hosting this lecture sorry I'm babbling out of amazement.

  • @pratiktelang6082
    @pratiktelang6082 6 лет назад +1

    the new IDLE has many new features that are not consistent with these lectures that might create some confusion... so guys you better watch yourselves out... for example (5/2) in the 1.4 shell version gives the number of multiples of 2 that fit in 5... in short it gives the first quotient.... but now in the latest shells, python provides the complete division like (5/2) gives 2.5.. but still these lectures are fantastic.... thanks to MIT OpenCourseWare

    • @espedale
      @espedale 5 лет назад

      Exactly. They made the change one year after this lecture was made, when Python updated from version 2 to version 3. Python 3.x now returns floats instead of integers.
      www.informit.com/articles/article.aspx?p=1439189

  • @victoriaindigo
    @victoriaindigo 13 лет назад

    It's so sweet how he throws out candy. I bet it encourages class participation!

  • @MrMackxl65
    @MrMackxl65 14 лет назад +1

    Indeed an Awesome Lecture just like we had at Berkeley from Prof. Cummings!

  • @pedrodogg69
    @pedrodogg69 13 лет назад +1

    All the reading im doing is not really helping but these videos are gold! thanks guys

  • @FloralMogul
    @FloralMogul 11 лет назад +1

    Exccellent teachings professor! I love the way you rendered the "Recipe Comparison Initiative," per say...:) Nice work! I've some questions but I'll await till I get most of the videos completed in viewing then I'll kinda take it from there. Thanks so much for the videos!

  • @goaty.
    @goaty. 8 лет назад +23

    python now correctly throws an error if comparing string to int:
    print('a'

    • @FloydManFloyd
      @FloydManFloyd 8 лет назад +1

      i wonder how they achieved this. did they change the function of

    • @adebayosodiq5344
      @adebayosodiq5344 7 лет назад +3

      The video was made 8years ago which mean python 3.5 was not in existence then. you can download 2.7 to get a taste of the execution.

    • @pratiktelang6082
      @pratiktelang6082 6 лет назад +1

      the new IDLE has many new features that are not consistent with these lectures that might create some confusion... so guys you better watch yourselves out...

    • @netux
      @netux 6 лет назад +2

      +Jonnie Poole they simply instructed the program to show an error

    • @zombiesalad2722
      @zombiesalad2722 5 лет назад +4

      The (x/2)*2 way of checking odd or even wont work out either in python 3. It automatically converts it to float while dividing.

  • @LucasMelin
    @LucasMelin 15 лет назад +1

    In python, each indentation is 4 spaces. Sometimes tab can give you more or less than that. Try indenting 4 spaces.

  • @MrPatrickDayKennedy
    @MrPatrickDayKennedy 9 лет назад +1

    YaY - the video projection of the mac screen output shows up great!
    Thanks MIT - this lectures series is fantastic!

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 лет назад

      Great question by one of the students - i was wonder what factored in to why 'a' > 'g' returns False, it's because the ASCII code for the symbol!
      Lotsa good stuff in here - I might need to watch it again. First tho, maybe time to start some of the associated lesson reading materials :)

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 лет назад

      Hi Metaphysical Axiom,
      If you dig permaculture, are you familiar with the work of Dr. Elaine Ingham? She's awesome!

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 лет назад

      Metaphysical Axiom,
      Here ya go:
      www.nofanj.org/LiteratureRetrieve.aspx?ID=104151

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 лет назад

      Metaphysical Axiom, it's a great means to extend your compost economy. The microbiological analysis in the manual is excellent for dialing in your application (bacterial or fungal dominance). & best of all - it's so easy: bucket of water, bubbler pump and hose (big bubbles, fine bubbles chop up the biology), a mesh bag, some good compost & voila! As for application, the pressure of a four foot drop is enough to kill up to half the biology - a gentle meditative approach is good, or, if you are irrigating, just avoid right angles in the piping and use a diaphragm pump (instead of a rotary one). Generally, if your brew is frothy & smells like rich soil, you are good to go!
      :-D

    • @MrPatrickDayKennedy
      @MrPatrickDayKennedy 9 лет назад

      Note to self:
      en.wikibooks.org/wiki/Python_Programming

  • @rickysteven1990
    @rickysteven1990 4 года назад

    Rumour has it that John is a legend

  • @rauc6788
    @rauc6788 13 лет назад +1

    @krenuds the link above had the last bit of the url cut out, the full url is
    ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/download-course-materials/
    download the zip and the handouts are under each lecture.
    On another note, thank you MIT for this wonderful resource!!

  • @GoredGored
    @GoredGored 4 года назад

    Type discipline, that sums up why most coders, so called coders, need to take this course. It is more like a lot of bad drivers on the road with a driving license. You need to go back to basics to be reminded of the correct way of driving.

  • @bhaumiktandan7815
    @bhaumiktandan7815 5 лет назад +2

    These lectures are really very good!

  • @MattMcConaha
    @MattMcConaha 10 месяцев назад +1

    RIP to the several million people who didn't make it to lecture 2

  • @andylovesringo
    @andylovesringo 11 лет назад +1

    Well if u wanna specifically major in computer engineering from a 4 year university, it will require lots of math. You will be required to take calculus I, II, III, differential equations, and linear algebra. Trig is recommended to have been taken during high school, otherwise you'll do it at college and be a little behind. Engineering is a tough discipline. I'm a senior in electrical engineering, and shit aint exactly easy. If you want to complete your degree, u have to be passionate about it.

  • @DJ369-Miami
    @DJ369-Miami 10 лет назад +1

    Kudos to MIT for this course!

  • @CrayolaMapleVideos
    @CrayolaMapleVideos 12 лет назад +1

    To everyone using python 3.0 and up, the even trick no longer works, as you no longer require floating integers to not do integer division.

  • @LucasMelin
    @LucasMelin 15 лет назад

    In python, whitespace is very important. Your code should look like this:
    x = 15
    if (x/2)*2 == x:
    print 'even'
    else:
    print 'odd'
    However, if you are using python 3, print is used as a function, so you need to type print('even') instead of print 'even'.

  • @christalkarat
    @christalkarat 11 лет назад

    Opps! I m a person who does not know anything about coding and programing. I love his lectures. :-)

  • @raserapps8230
    @raserapps8230 8 лет назад +34

    wow, I'm sure his IDLE shell said something like version 1.4 or something
    Nevertheless I am finding these lectures very interesting even if they are a few years old, it is amazing that there's resources like this available, not everyone's in a position where they can actually attend a University so it is really cool to have this available.
    Thanks

    • @coletravers9959
      @coletravers9959 7 лет назад +2

      Yeah, wish they could have some updated versions as we all know how fast computers are evolving, but good nevertheless.

    • @PeppoMusic
      @PeppoMusic 7 лет назад +3

      7XCOLE for this course that is mostly irrelevant, as these fundamental computation principles have remained largely unchanged. They are still a good basis to start from learning more contemporary techniques and languages. It is not a course about Python, remember?

    • @christoandries7117
      @christoandries7117 6 лет назад

      Ben W even University don't teach for beginners it wasn't a fun experience

  • @bradhill6074
    @bradhill6074 7 лет назад +1

    @32:37 why is the program returning the "odd" statement?
    What is happening in my mind is 15 being divided by 2 yields 7.5, and because 15 and 2 were entered as integers with no periods, the resulting "7.5" would yield only the integer "7". This is then multiplied by 2, creating an EVEN number rather than the "odd" resulting text.
    What am I missing here? TIA

    • @szebohalasz7793
      @szebohalasz7793 6 лет назад +1

      Because if you divide 15, you get 7, next step is comparing 7*2 with the original number (15). If those two are not same, you get "ODD". Doesnt matter if the number itself is even or not.

  • @sumittripathi1331
    @sumittripathi1331 4 года назад +4

    In new Versions of python 'a'

  • @gpjapan
    @gpjapan 7 лет назад +1

    Branching section starts at 29:10.

  • @oylenshpeegul
    @oylenshpeegul 13 лет назад

    @37studios He is using IDLE, which is an IDE (integrated development environment) that comes with Python. IDLE is doing the colors. He appears to be using Python 2.4, but IDLE comes with every version of Python.

  • @phatsk8r420
    @phatsk8r420 13 лет назад

    UM... Wow! This is some sweet stuff right here... I cant believe I'm sitting in on an MIT CS lecture!!! AWEsOME!

  • @HyperElf9
    @HyperElf9 13 лет назад +1

    On a second note these videos are awesome! Thank You!

  • @kevinkiesel4937
    @kevinkiesel4937 11 лет назад +1

    It helps if you save the program with a ".py" it keeps your words highlighted

  • @Erock634
    @Erock634 3 года назад

    @24:00 I slightly disagree. If you can read code anyone wrote a year after it was written and understand it clearly it is a sign of good code. There needs to be a balance on the amount of comments in code. Too many and they become like ads; no one reads them and they just clutter space.
    I think of comments as ways to explain intentions. Comments are also important to warn the reader. Sometimes history can be captured but that is more for business reasons; linking a change in code to documentation or a work tracking ticket.
    I teach my engineers these concepts:
    1. Comments shouldn't explain the language. Example of bad comment: // this code multiples the 2 arguments and averages them
    2. Rename something if it isn't clear.
    3. Complex expressions often should be refactored into macros, functions, methods, etc. for readability. `if (((a + b) / 2) > last_average)` is worst than `if (AVERAGE(a, b) > last_average)` the first slows down the reader, second is concise.
    4. Block comments should be a block and not inline. (We break this rule for comments within expressions `int func(/*enable=*/true, /*interations=*/6);`)
    5. Line comments should be at the end of a statement.
    There are a few other rules we follow.
    What rules do other people follow?

  • @alankritsrivastava1475
    @alankritsrivastava1475 6 лет назад

    In case you are using python 3, the expression:
    4>> 4>'a'
    Traceback (most recent call last):
    File "", line 1, in
    4>'a'
    TypeError: '>' not supported between instances of 'int' and 'str'

  • @MichaelSignor
    @MichaelSignor 11 лет назад +1

    Great videos for learning Python syntax. I like how the developers force you into a structured coding environment. :-)

  • @surfpub2001
    @surfpub2001 15 лет назад +1

    Awesome lecture. Detailed instructions followed by solid examples.

  • @tc8557
    @tc8557 11 лет назад +1

    Just a note on what's going on at 33:05.
    It seems that division automatically returns a float in the current version of Python, 3.3.
    So that piece of code would always print "Even".
    Love the lectures btw, I'm quite hooked.

  • @aydinjalilov2328
    @aydinjalilov2328 5 лет назад +1

    Python made a long way since this MIT class but there is still lots of useful information.

  • @thomaboyle8575
    @thomaboyle8575 7 лет назад +1

    Thank You for This quality Free education content, very much perseverated !

  • @dacoup5955
    @dacoup5955 9 лет назад +2

    Again really appreciate the lectures.. guys much appreciated

  • @Paradox924X
    @Paradox924X 15 лет назад

    Another way of doing it besides riding on integer arithmetic (which could fall through if somehow a floating point gets assigned to a variable which will, as per python's design, dynamically change into a variable that holds floating points) would be to use the modulus operator, %.
    For example:
    if x%2==1: print 'Odd'
    else: print 'Even'

  • @ThePastelAssassin
    @ThePastelAssassin 8 лет назад +5

    I just wanted to say thank you for the free lectures, however I do have a criticism. I understand this video was recorded in 2009 so maybe higher definition video camera wasn't available but taking down notes from the chalkboard or reading code on the projector is very blurry. If there is a 720p or higher version that can be uploaded I would greatly appreciate that.

    • @mitocw
      @mitocw  8 лет назад +13

      Sorry but the source is in SD (standard definition), but there are handouts available for the course on MIT OpenCourseWare at ocw.mit.edu/6-00F08 under the "Related Resources" tab for each video. You might also want to checkout the Scholar version of the course which has more complete materials (online textbook, exams with solutions, assignments with solutions, etc.) at ocw.mit.edu/6-00SCS11.

    • @ThePastelAssassin
      @ThePastelAssassin 8 лет назад +1

      Thank you for the prompt reply and helpful information. :)

  • @aaronhughes3278
    @aaronhughes3278 8 лет назад +2

    really complicated but after a bit of research i understand more, what an excellent educational video, thanks +MIT OpenCourseWare

    • @mrnettek
      @mrnettek 6 лет назад

      It becomes way more complicated. Good luck.

  • @cyclist14
    @cyclist14 13 лет назад +1

    I really love programming, its like art for smart people! (not saying that artists are stupid)

  • @Rback189
    @Rback189 Год назад

    Excellent material. Someone needs to get this man a keyboard and mouse.

  • @aashishgarg3469
    @aashishgarg3469 12 лет назад

    thats because = is an assignment operator and == is relational operator...to compare two values, relational operators are used

  • @zigginzag584
    @zigginzag584 4 года назад +2

    Wow, the first lecture had over 5 million views while this one only has less than 1 million presently.
    80% drop rate after first class is quite significant. I wonder how many finish?
    I wonder if I will?

  • @VGhev
    @VGhev 7 лет назад +2

    In python 3.5 te expression 'a' < 3 is type-checked and pops the TypeError: unorderable types: str() < int()

  • @Colstonewall
    @Colstonewall 13 лет назад

    @ShitWrangler It's all in what you find interesting. If this bores you, then it may not be the class for you. When I was younger, this would have bored me to tears. Now, I LOVE IT!

  • @Paradox924X
    @Paradox924X 15 лет назад

    TrollingAround is referring to the bitwise and operator, &.
    if x&1: print 'Odd'
    else: print 'Even'
    He is correct in saying that it is much faster because bitwise operations are much quicker and easier to perform than regular arithmetic.
    @alphydan:
    the 'and' keyword in python refers to the logical and, not the bitwise and. In terms of booleans and integers, any non-zero value is equivalent to TRUE.

  • @mertcan8400
    @mertcan8400 3 года назад

    when I saw it first I was really surprised beacuse it is a very good oportunitiy for the person who wants to improve himself

  • @Never1st
    @Never1st 14 лет назад

    @aHbEnZhAi X is assigned to the value of 15, Y also. If you change X, you change the pointer of X to point to a new value. You do not change the value itself, so 15 is still 15, thus Y remains 15, while X has a new value.

  • @anilbhattarai8661
    @anilbhattarai8661 5 лет назад

    >>> 'a' < 3

    Traceback (most recent call last):
    File "", line 1, in
    'a' < 3
    TypeError: '

  • @RiftRaft123
    @RiftRaft123 14 лет назад

    I learned about numbers and strings this year in high school. That is about all we learned in my shitty computer science class. But college gives me hope because i dnt know most of what this guy is talking about, but I definately want to know. Hopefully my college professor will be as energetic while teaching.