WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000 00:00:24.000 --> 00:00:25.083 DAVID MALAN: Hello, world. 00:00:25.083 --> 00:00:28.410 My name is David Malan, and this is CS50's Introduction 00:00:28.410 --> 00:00:29.880 to Programming with Python. 00:00:29.880 --> 00:00:33.720 Whereas CS50 itself is an introduction to the intellectual enterprises 00:00:33.720 --> 00:00:35.880 of computer science and the art of programming, 00:00:35.880 --> 00:00:40.210 this course is specifically focused on programming in Python itself. 00:00:40.210 --> 00:00:42.210 At the beginning of the course, we'll be focused 00:00:42.210 --> 00:00:45.570 on a topic in programming known as functions and variables, mechanisms 00:00:45.570 --> 00:00:48.150 via which you can write code that solves smaller problems, 00:00:48.150 --> 00:00:51.000 but you can compose those smaller solutions into solutions 00:00:51.000 --> 00:00:52.530 to larger problems still. 00:00:52.530 --> 00:00:54.630 We'll then transition to a look at conditionals, 00:00:54.630 --> 00:00:59.070 a way in code of expressing yourself logically, to maybe do something 00:00:59.070 --> 00:01:02.340 if some question has an answer of true, or not 00:01:02.340 --> 00:01:04.260 do something if the answer is false. 00:01:04.260 --> 00:01:06.240 We'll transition thereafter to introducing you 00:01:06.240 --> 00:01:09.900 to loops, the ability, in code, to do something again, and again, 00:01:09.900 --> 00:01:11.820 and again some number of times. 00:01:11.820 --> 00:01:14.280 We'll then transition to something a little more technical, 00:01:14.280 --> 00:01:15.390 known as exceptions. 00:01:15.390 --> 00:01:18.353 Unfortunately, a lot can go wrong when you're writing code, some of it 00:01:18.353 --> 00:01:20.520 your fault, some of it perhaps someone else's fault. 00:01:20.520 --> 00:01:23.790 But you can write code defensively, so to speak, and actually 00:01:23.790 --> 00:01:26.100 catch those kinds of exceptions, those errors, 00:01:26.100 --> 00:01:29.310 and handle them properly so that the users you're writing code for 00:01:29.310 --> 00:01:30.990 don't actually see the same. 00:01:30.990 --> 00:01:34.380 Thereafter, we'll take a look at libraries, third-party code, 00:01:34.380 --> 00:01:37.470 written by other people, often, or perhaps yourself in the past, 00:01:37.470 --> 00:01:40.040 that you can use and reuse in your own projects 00:01:40.040 --> 00:01:42.960 so as to avoid reinventing the wheel again and again. 00:01:42.960 --> 00:01:45.690 We'll look thereafter at something called unit tests. 00:01:45.690 --> 00:01:49.530 It turns out, you'll actually write code to test your own code. 00:01:49.530 --> 00:01:51.780 But you won't have to write tests for your tests. 00:01:51.780 --> 00:01:55.240 Indeed, this is a best practice in industry, writing tests for your code 00:01:55.240 --> 00:01:58.200 so that one, you can be sure that your code today is, hopefully, 00:01:58.200 --> 00:02:00.490 if your tests are correct, correct itself. 00:02:00.490 --> 00:02:04.320 But moreover, if you or someone else modifies your code tomorrow, or down 00:02:04.320 --> 00:02:07.380 the line, you can rerun those same tests to ensure 00:02:07.380 --> 00:02:10.850 that those new changes have not broken anything about your own code. 00:02:10.850 --> 00:02:12.600 We'll then take a look at something called 00:02:12.600 --> 00:02:15.780 File I/O, I/O for input and output, the ability 00:02:15.780 --> 00:02:19.200 to not just store information inside of a computer's memory, 00:02:19.200 --> 00:02:23.567 but rather save it persistently to disk, so to speak, to files and folders. 00:02:23.567 --> 00:02:25.650 We'll then take a look at another technique, known 00:02:25.650 --> 00:02:29.760 as regular expressions, whereby, in Python, you can define patterns 00:02:29.760 --> 00:02:33.240 and you can validate data to make sure the human typed something in as you 00:02:33.240 --> 00:02:33.910 expect. 00:02:33.910 --> 00:02:36.360 You can use regular expressions to extract data, perhaps 00:02:36.360 --> 00:02:38.760 from some data set you're trying to analyze. 00:02:38.760 --> 00:02:42.660 We'll then take a look, ultimately, at object-oriented programming, 00:02:42.660 --> 00:02:46.530 a paradigm, a way of writing code, whereby you can represent, in code, 00:02:46.530 --> 00:02:47.777 real-world entities. 00:02:47.777 --> 00:02:50.610 And this is in addition to other paradigms of programming that we'll 00:02:50.610 --> 00:02:53.220 also explore, among them procedural programming, 00:02:53.220 --> 00:02:55.440 where you write lots of those functions, procedures 00:02:55.440 --> 00:02:58.110 really, top to bottom, to solve problems step by step, 00:02:58.110 --> 00:03:01.053 and even something known as functional programming, as well. 00:03:01.053 --> 00:03:02.970 And then at the very end of the course will we 00:03:02.970 --> 00:03:06.270 equip you with all the more tools for your toolkit. 00:03:06.270 --> 00:03:09.180 and additional building blocks, additional vocabulary 00:03:09.180 --> 00:03:12.300 via which, after this same course, you can go off on your own 00:03:12.300 --> 00:03:15.150 and either take other courses or solve projects of your own, 00:03:15.150 --> 00:03:17.250 using all of these mechanisms. 00:03:17.250 --> 00:03:20.860 Now this course itself assumes no prior programming background. 00:03:20.860 --> 00:03:23.610 So you don't have to have written a single line of code in Python, 00:03:23.610 --> 00:03:25.150 or any language, yet. 00:03:25.150 --> 00:03:29.730 But this is also a course that you can take before, during, or even after CS50 00:03:29.730 --> 00:03:33.000 itself, if you'd like to get all the more versed with Python. 00:03:33.000 --> 00:03:35.700 Each week, via the courses lectures, will we introduce you 00:03:35.700 --> 00:03:37.830 to any number of concepts that we'll then 00:03:37.830 --> 00:03:41.070 drill down more deeply into in the form of problem sets each week. 00:03:41.070 --> 00:03:43.470 That is, programming projects that will enable 00:03:43.470 --> 00:03:47.460 you to apply some of those lessons learned to problems of your very own. 00:03:47.460 --> 00:03:49.650 And by the end of the course, you'll have 00:03:49.650 --> 00:03:53.190 solved so many problems that, ideally, are representative 00:03:53.190 --> 00:03:55.930 of problems you'll eventually encounter in the real world, 00:03:55.930 --> 00:03:58.680 whether you aspire to solve code in the technical world 00:03:58.680 --> 00:04:01.440 or perhaps in the arts, the humanities, the social sciences, 00:04:01.440 --> 00:04:03.210 the natural sciences, or beyond. 00:04:03.210 --> 00:04:06.570 You'll have, ultimately, the vocabulary and the technical skills 00:04:06.570 --> 00:04:08.580 via which to approach the same. 00:04:08.580 --> 00:04:10.500 This, then, is CS50. 00:04:10.500 --> 00:04:15.470 And this is CS50's Introduction to Programming with Python.