RUVIDEO
Поделитесь видео 🙏

Python Tutorial for Beginners - Python List Comprehension - Python List Creation

This video shows some examples of how to make lists in python in one line using list comprehension. You can use for loops and if statements inside of list creation to create large lists in one line. This tutorial is done in ipython.

This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Master Python Rylan Fowers.

✅Subscribe: https://www.youtube.com/channel/UCub4qT8Sgm7ytZsO-jLL4Ow?sub_confirmation=1

?Channel: https://www.youtube.com/channel/UCub4qT8Sgm7ytZsO-jLL4Ow?

▶️Watch Latest Python Content: https://www.youtube.com/watch?v=myCPgAO9BgQ&list=PLL3Qv26_SCsGWTF5PRaWUY0yhURFvco7L

▶️Watch Latest Other Content: https://www.youtube.com/watch?v=2YfQsLd2Ups&list=PLL3Qv26_SCsFVXXdsxOSB00RSByLSJICj&index=1





LIST COMPREHENSION

This video will show you how to make large lists in one line with a few examples

In the first example we define our list with brackets and then type a mini loop for x in range(0,10)

This will give 0 through 9 since it includes the first number but not the last in the range

IN this next example we show you the same thing but with negative numbers. We will end the range at 11 to include positive 10

Here is the print out

Next we will include an if statement inside our list comprehension. We will say if x mod 2 is equivalent to 0.

This puts numbers in the list that are even, or divisible by 2

Next we will do an if statement and include and else clause. Let’s say if x mod 2 and else do x squared.

This will print all the numbers in the range and square each one that is equivalent to 0 mod 2.

So 2 squared is 4, 3, then 4 squared is 16 and 5, and 6 squared is 36 and so on

IN this last example we will use an inequality with our if statement. So if our x is greater than or equal to 0 we will keep it, else we replace it with a 1. Here is the print out

There you have it, that is an introduction of how you do python list comprehension.

#PythonMarathon #LearnPython #PythonTutorial

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tutorial for Beginners - Python List Comprehension - Python List Creation», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.