Expressions Part 3 | make your first python programme
thing that's a friendly thing in programs for humans, and you will tend to realize that the human that you're being friendly to when you're writing code and you're doing it well, is yourself. So good variable names are going to help you a lot. They might help your teaching assistant but they're also going to help you. Comments. Comments are a way for us to add text that's ignored by Python to our programs. So it's a great way to give a little idea what's going on in code, maybe there's a couple of lines coming up that are 10 lines long that's a little complex and you want to say, "Oh, all this is really doing is reversing the order of these two things," or who knows what. Or you might document who wrote the code and you can actually just take a line of code and put a pound sign in front of it instead of deleting the line of code. Sometimes, you do that for debugging. You add debugging code and then when you don't want the debugging code, you just put a pound sign in case you want to take the pound sign out to turn the code back on. So I use it as a way to turning off and on lines of code. So here is a word frequency that we keep coming back to and what I've added here is I've added four comments. I've added comments that basically help us understand what's going on, and remember I call these like paragraphs. Our first paragraph has human-readable code, human-readable text. Get the name of the file and open it. That's what's going to happen in the next two lines. These next five lines are count the word frequency, maybe I should say make a histogram. So make a histogram and you can just read this. So, again, don't think of this as like the teacher's telling you you've got to write comments. Think of this as like, "I'll write comments so I remember what I was doing here. Why did I write this code?" So write the comments to help yourself out. Now, here, the last thing, we're all done and we're printing this stuff out, okay? So that's comments, it's an important part of documenting your code so that you can figure it out later. Again, the human who's going to like you for doing all this stuff is you. All right. So this is you and you're giving a gift to the future you, right? So you are writing comments so that the future you can read the comments. Because in a day or a week or a month, you won't quite remember what you were doing so go ahead and write comments. But don't write them because I said so. Write only the ones that you find useful and don't do something like x equals 1, pound sign, put one in x. That's silly, everyone can figure out what x equals 1 means. So you don't put silly comments in just for silliness, you just put them in especially when you have to understand what's going on here so that people don't have to read quite so detailed. One of things they would do is they would read this and check to see if it really did what you said it was going to do to help you debug it, for example. So that's comments. Documentation, very important.
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Expressions Part 3 | make your first python programme», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.