?

Log in

No account? Create an account

Previous Entry | Next Entry

Video Notes
Lec 3 | MIT 6.00 Introduction to Computer Science and Programming, Fall 2008 - 51:00
http://www.youtube.com/watch?v=X6ilT3uUOBo&list=PL7BC1DAED2189CFA6&index=3

Three aspects to writing code, data, operations, and commands. Data is numbers, strings, and booleans. Operations are things like addition and multiplication, +, *, on booleans we use AND and OR. On commands we've seen assignment, input/output, conditionals or branches and loop mechanisms. How do we put all of this into common templates? We're going to build common patterns of code that tackle common problems.

Iterative programs require a verrable as a counter - that changes every time we go through the program. We need to initialize it outside of the loop. We need to setup a test to know when we're done with the loop. And finally we need to construct a block of code with the variable as the counter changing. What do we do when we're done? Flowcharts can be very helpful in designing blocks of code.

# find square root
ans=0
while ans*ans <= x:
ans=ans+1
print and

To simulate the code we could put print statements in all sorts of places. We can also run through the loop manually by placing values into x and ans.

Defensive programming is making sure we go through all possible paths of the code, we're returning information for each path and that for all possible inputs there is a path through the code. Basic idea of defensive programming is to assume that user input won't necessarily be what you're asking for. And if you're using a piece of code by someone else there could be mistakes in the program, you write code that parts of your program could make mistakes, so you put in tests to catch something going wrong.

Exhaustive enumeration is walking through all possible values, testing everything until we find the right answer. Try all "reasonable" values until you find solution.

For loop is like this: for in . for i in range(i, x):
We don't need a counter variable since the for loop automatically increments i for us.

Tuple is an ordered sequence of elements. It is immutable.
too = (1, 2, 3, 4)
too[0]=1, too[2]=3..etc.
0th element is the first one. Numbering starts at zero.
too[1:3]=2,3 this is called slicing.
Strings also support selection, slicing.
s1="abcdefg"
s2="zxy"
s1+s2=abcdefgzxy
s1[0]='a'
s1[2:4]='cd'
s1[:5]='abcde'
str converts numbers to strings. int converts strings into integers.

Comments

( 6 comments — Leave a comment )
ryukei
Oct. 27th, 2011 04:34 pm (UTC)
Congratulations!!
Finally you listened to me and are writing things down!! yeah!
I'm very glad you're doing this note-taking thing, I'm sure it will help you to remember those lessons better.
Because taking notes forces you to rephrase what is being said, and to rephrase something, you have to understand the meaning of it. And also, rephrasing means writing with your own words, words that you understand.
So even if you don't remember everything right away, read your notes again in a week or so, and all will come back to your mind very easily :)

Soon, you'll be writing lists as well hehehe

Also, a good thing you should post about is: what do you think about those lessons? because your notes are interesting, but what your feelings about them?

spty
ryukei
Oct. 27th, 2011 04:38 pm (UTC)
Re: Congratulations!!
oh and in case you're wondering what "spty" means, I don't know lol
I wanted to write "stys" instead, speak to you soon lol
so SPTY could mean super pretty tall young (woman) lol
:-*
maslacak
Oct. 27th, 2011 06:43 pm (UTC)
Re: Congratulations!!
Ahhh I like spty.. it describes you very well... heh :)
maslacak
Oct. 27th, 2011 06:42 pm (UTC)
Re: Congratulations!!
Yes I'm very stubborn. I still think I should be a super computer who can learn without taking notes, just by listening. How do blind people learn? They don't take notes, they just soak up the information and learn without taking notes. WHy can't I learn that? I'm almost blind anyway so maybe I'm broken... :(

And what does spty mean at the end of your response????
ryukei
Oct. 28th, 2011 07:11 am (UTC)
Re: Congratulations!!
Nobody learns like that, or maybe only a few.

Blind people are not computers.
It's true that they usually develop a better memory than other people who can see. But it's because they're training their memory everyday.

For instance, I know some memorize the number of steps. For instance, how many steps between the bed and the bathroom, how many steps between their door and the bakery and so on. At the beginning, they forced themselves to remember it, then it becomes natural. Others uses the sounds to locate themselves, they're much more sensitive than we are to sounds (horns, birds, cars..) and smells than we are.
For "normal" people ( don't like that word), the sight is the most developed sense, then I think it's usually the taste.
For blind people, they develop touch, hearing and smell more than we do.

When I was at the University, 7 years ago (damn, I'm getting old hehehe), there was a young woman that was blind. She was attending the lectures with her dog, and she had a special computer/machine to type in Braille. So she was taking notes. She was also recording the lecture, and she told me that when she has to study for an exam, she would re-read her notes and complete them by listening to her tapes. Also, she was helped by someone at home. Because in our class books, if there were pictures, she could see them. So the person would describe the pictures very precisely to her so she can take more notes.
She also told me that she was reading a lot (audio books or Braille books). Reading helps you to increase your vocabulary, makes your memory and your imagination work.

So blind people don't have supernatural powers, they just develop other methods to study and remember things. But I do think they have to work harder than others, it requires more efforts and work.

You're not broken. You're just not used to study. Study is not something you know how to do by nature, it's something you have to figure out. Every body has a different way of learning. There are main patterns, I mean general methods, but you got to find the one that works for you.
maslacak
Oct. 28th, 2011 12:47 pm (UTC)
Re: Congratulations!!
You're right...
( 6 comments — Leave a comment )

Profile

success
maslacak
Future Master

Latest Month

September 2012
S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30      

Page Summary

Powered by LiveJournal.com
Designed by Tiffany Chow