Lists in Python | Python | Episode 6
Hey guys, Today we are going to learn lists
Look below for more information:
Lists is type of a data structures. It can be changeable. The reason why we use lists is because it is easy to handle data
You would use [ ] (square brackets)
https://www.w3schools.com/python/python_lists.asp - Take a look at this website for lists in python
Python is a programming language used to build A.I.(Artificial Intelligence),
Websites, and many MORE!!!!
In the last video, we talked about for and while loops statements.
Instead of saying print('Hello, World') like 200 times, we can use for loops to
print them. It is much easier and more effiencent. You would say something like this:
for i in range(200):
print("hello, World")
When your run this code, it will print out that many times. You will notice that I put an "i" in the for loop. You can put whatever you want. What this does is that it's going to hold on the value and print them.
While Loops,
While loops are another way of iterating over a sequence, it going to repeat until the statement is false
let's set a variable that says:
a = 0
so know you can say
NOTE: Youtube doesn't allow less than or greater than symbols so I will be saying less than adn greater than sign
while a less than* 3:
print("hello world")
When you run this code, you will notice that the loop is in a infinite loop.
You have to increment it
a = 3
while a less than* 3:
print("hello, World")
a = a+1
Instead of a = a + 1, you can say a+=1.
if and else statements are basically tells the code if this statement is True, it's going to do something OTHERWISE, do something else
The way that you write is. First,
NOTE: # means to comment
you say:
if #write condition:
#do something
else:
#do something else
so first let's take 2 variables
a = 5
b = 2
Let's say that I want to print out ' a is smaller than b' ONLY if a is smaller than b. In my case the VARIABLE a is not smaller than B.
So the way that we can say is
(NOTE: The greater sign in disabled for me due to the youtube description polices)
(NOTE: so, I will say word 'Greater*' as the greater than sign
if a Greater* b:
print('a is smaller than b')
else:
print('b is smaller than a')
Correct Output: b is smaller than b
Of course, you can say more than if statements
you can say:
(NOTE: The greater sign in disabled for me due to the youtube description polices)
(NOTE: so, I will say word 'Greater*' as the greater than sign)
a = 2
b = 2
if a Greater* b:
print('a is smaller than b')
elif a == b:
print('a is equal to b')
else:
print('b is smaller than a')
Correct Output: a is equal to b
REMEMBER THAT INDENTION ARE VERY IMPORTANT
Special Keys:
THERE IS A DIFFERENCE BETWEEN '=' and '==' in python( in any language)
'=' means equal
'==' means when you want to compare 2 objects.
Greater* sign and = means Greater than or equal to
Less* sign and = means less than or equal to
* means mulitplication
- means subtraction
+ means addition
/ means division
** means square
% means module or Remainder
# means comment
Keep Coding :)
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Lists in Python | Python | Episode 6», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.