본문 바로가기

MIT challenge

(15)
6강 - Recursion and Dictionaries Lecture 6: Recursion and Dictionaries | Introduction to Computer Science and Programming in Python | Electrical Engineering and MIT OpenCourseWare is a web based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity ocw.mit.edu Review / Preview 더보기 저번 시간 내용 : https://ikablog.tistory.com/12 1. Tuple, List 새로운 Datatype. 2. 얘네로 인해 만들..
5강 In-class Questions 1번 더보기 함수의 입력값중 ('cloudy')는 괄호 안에 있어도 tuple이 아닌 string 취급이다. 원소가 하나인 tuple을 만들고 싶었다면 그 다음 입력값처럼 쉼표를 넣어줘야 한다. ('cold',) 그래서, first = 'c' + 'cold' 가 되고, 출력값은 ('sunny', 'ccold') 가 된다. 2번 더보기 for thing in L은 리스트 안에 있는 각 원소들을 대상으로 Loop를 실행하게 된다. 이때 42가 세 번째 원소로 있기 때문에 elif~ 조건을 만족하고, 리스트의 두 번째 원소는 "everything"으로 바뀐다. 리스트의 네 번째 원소는 0으로 if~ 조건을 만족하고, 이에 따라 L[thing], 즉 L[0]이 'universe'로 바뀐다. 결과적으로 ['uni..
1단원 - 도함수 Calculus 1A: Differentiation How does the final velocity on a zip line change when the starting point is raised or lowered by a matter of centimeters? What is the accuracy of a GPS position measurement? How fast should an airplane travel to minimize fuel consumption? The answers to al openlearninglibrary.mit.edu 블로그 글처럼 쓰는 것에 얽매여 본질을 놓쳤다. 시간도 너무 오래 걸리고 진도도 안 나간다. 내가 공부하기 위해 시작한 프로젝트인데... 너무 꾸미지 ..
5강 - Tuples, Lists, Aliasing, Mutability, and Cloning Lecture 5: Tuples, Lists, Aliasing, Mutability, and Cloning | Introduction to Computer Science and Programming in Python | Elect MIT OpenCourseWare is a web based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity ocw.mit.edu Review / Preview 더보기 저번 시간 내용 : https://ikablog.tistory.com/9 1. 함수를 통한 Decomposition과 Abstraction. Dec..
0. Calculus 강좌 찾기 MIT open courseware에서 Calculus, 또는 18.01을 검색하면 정말 많은 강좌가 나온다. 끝에 달린 SC라던지, 18.014라던지, 디테일은 달라도 커버하는 범위는 다 Calculus I 내용이다. Calculus II, 또는 18.02도 마찬가지다. 18.022, 18.024 등 다양한 강의가 존재한다. 아무래도 기초 학문이다보니 많은 교수님들이 강의를 했나보다. 일단 Calc I는 edX에 올려진 강의를 듣기로 하였다. 2020년 강의라 비교적 최신판이기도 하고, edX의 인터페이스 자체가 편하기도 하고. Calc II의 경우엔 3부작(?) 중 2번째 시리즈까지만 올려져있어서 고민을 좀 해봐야 할 것 같다. https://www.edx.org/xseries/mitx-18.01x-..
4강 In-class Questions 1번 더보기 add() 함수는 print()가 없으므로 아무런 결과값도 화면에 출력하지 않는다. 한편 mult() 함수는 print()가 있으므로 실행할 때마다 x*y 값을 화면에 출력하고, return이 없으므로 None을 반환한다. 차례대로 add(1,2)는 아무것도 출력하지 않고, print ( add (2,3) ) 은 5가 출력되고, mult( 3,4 )는 12가 출력되고, print ( mult(4,5) ) 는 20과 None이 출력된다. 따라서 총 네 줄이 출력된다. 2번 더보기 calc = sq(f, 2)에서 sq 함수를 호출하게 된다. 여기에 func = f, x = 2를 할당하고 코드를 실행하면, y=x**2에서 y=4가 되고, 이 함수는 결국 f(4)를 반환하게 된다. f(4)는 4**..
4강 - Decomposition, Abstraction, and Functions Lecture 4: Decomposition, Abstraction, and Functions | Introduction to Computer Science and Programming in Python | Electrical E MIT OpenCourseWare is a web based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity ocw.mit.edu Review / Preview 더보기 저번 시간 내용 : https://ikablog.tistory.com/7 1. 문자열 가지고 놀기, string manipulation len(),..
3강 In-class Questions 1번 더보기 Str끼리는 덧셈이 가능하다. 덧셈을 하게 되면 앞 문자열에 뒷 문자열이 그대로 이어진다. 순서대로 따라가보면... new_str = "" new_str += s[-1]#s[-1]은 맨 끝 문자인 2, new_str = '2' new_str += s[0]#s[0]은 첫 문자인 6, new_str = '2'+'6' new_str += s[4::30] #s[4::30]은 " ", new_str = '26' + ' ' new_str += s[13:10:-1]#s[13:10:-1]은 13번째 문자, 12번째 문자, 11번째 문자를 포함 - new_str = '26 ' + '100' print(new_str)#26 100 2번 더보기 indent가 잘못 되어있어서 이대로 돌리면 오류가 나는 코드. 아..
3강 - String Manipulation, Guess and Check, Approximations, Bisection 링크 Lecture 3: String Manipulation, Guess and Check, Approximations, Bisection | Introduction to Computer Science and Programming in MIT OpenCourseWare is a web based publication of virtually all MIT course content. OCW is open and available to the world and is a permanent MIT activity ocw.mit.edu Review / Preview 더보기 저번 시간 내용 : https://ikablog.tistory.com/5 1. 문자열 (String) 2. 제어 흐름 - if, elif, e..
1, 2강 In-class Questions 1강 In-class Questions 1강의 1, 3번 코드는은 이상하게 따옴표 (' ')가 쳐져있다. 그래서 그대로 풀면 전부 다 string이라서 아무것도 안 나온다. 문제를 풀 때는 따옴표가 없다고 생각하고 풀면 된다. 답이 그렇더라. 1번 더보기 A> 2.0. type(5)는 int이지만 우리는 출력하라고 명령을 하지 않았다. 컴퓨터는 우리가 시킨 것만 하기 때문에 명령받은 (3.0-1), 2.0만을 출력한다. 열심히 계산해놓고 결과물을 빼먹는 실수를 조심하자. 2번 더보기 A > 4번. 파이썬에서 = 는 같다 라는 뜻이 아니다!!! "같다"를 뜻하는 논리연산자는 ' == ' 이다. = 는 왼쪽 객체에 오른쪽을 값을 할당하는 할당연산자에 해당한다. 따라서 이 문제의 핵심은 왼쪽의 변수명 (객체의..