Learn Python Programming - 13 - Append List Method

preview_player
Показать описание
...
★☆★ FREE Lesson 1: The Most Important Thing For a Successful Programmer★☆★

Enroll for coding exercises, projects, tutorials, and courses...
Clever Programmer
Snapchat ► Rafeh1
Рекомендации по теме
Комментарии
Автор

You're the man! Honestly when you said practice when you watch, though it is common sense I realize that its not so common. I struggled with code because of the usual "watch video about this ---> attempt to decipher complex code". Instead now I always pull up my jupyter notebook and practice every step and for the first time I feel like it just "clicks".

Not a big deal but has helped tremendously..Thanks man!

brianambrosini
Автор

everyone else is learning and im paying attention to his cursour freaking out

edwardmoisei
Автор

#Fibonacci Sequence (Infinite)
#Note: To stop loop press CTRL + C

first = 0
second = 1
sequence = [0, 1]

print(first)
print(second)

while True:
sum = first + second
sequence.append(sum)
print(sum)
first = second
second = sum

alextegrado
Автор

I made a simple triangle with numbers ( visually :D ) ;

 numbers = [ ]

for number in range(21):
numbers.append(number)
print (numbers)

sacidaksoy
Автор

I'm sure this is addressed in a later video, but usually when i follow your videos i usually vary your lists or scripts a bit just to have some differentiation and maybe see what problems i could run into with different scenarios. With this video rather than do your "numbers" list I did a small list of coworkers, which when appending by a loop clearly wouldn't add anything since there is no defined list of my coworkers to pull that information from. How would i append from a list like that after creating one?

svenstubes
Автор

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
for number in range(10, 21):
numbers.append(number)

jaydenpeyper
Автор

thanks for explaining a lot of concepts in one single video
it was fun to watch and amazing to apply
tank you so much

srinivasmalvadkar
Автор

when I use list(range(x, x)), how do I remove the square brackets from the listed numbers (if possible)?
For example:
list(range(1, 11)) will give me:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
How would I remove the square brackets? Its for a small project.
Wish everyone a great day.

cpt-
Автор

it's cool!, Is it?
number = [1, 2, 3, 4, 5]
for i in range(1, 10):
number.append(i+5)
print number

santosniwpanne
Автор

how to append another list into a list.
fruits=['apple', 'banana', 'orange']
tastyfruits=['mango', 'watermelon', 'melon']
fruits.append(tastyfruits)
print(fruits)

the result was ['apple', 'banana', 'orange', ['mango', 'watermelon', 'melon']]
i want it to be like a bunch of strings but not strings and a list.
what should i do in order to achieve that?

fanryan
Автор

list1 = [3, 5, 14]
for number in range(0, 21):
if number in list1:
list1.remove(number)
else:
list1.append(number)
print (list1)
Main question is how not to remove number in the list, but how to skip one loop operation?

dommass
Автор

numbers.reverse() is also give you a reverse list

meetrajpopat
Автор

@7:59 in the video there is a syntax that you ran, I am not understand why it printed out starting from the number 1 when the range says (8, 21)?

calvinmitchell
Автор

Clever_programer(go home)

Output----
Error occurred clever program do not support that feature

It was at this moment i knew I

Someone-kwmw
Автор

numbers = [1, 2]
>>> numbers
[1, 2]
>>> for number in range(3, 51):
numbers.append(number)


>>> numbers
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50]

JV-slks
Автор

spiral


import turtle

t = turtle.Turtle()
for i in range(999):
t.circle(10+i, 45)

valeraezekielvancleoi.
Автор

loop is a hidden list in backgroud, its gonna make the loops very much easier for me to understand

Vj__
Автор

This really works well in making a self-calculating program on fibonacci sequence. Thanks for the additional information :)

ajansit
Автор

I messed around with this and created the following list

names = ('jerry', 'jason', 'paul')

then when I went to append this I attempted to add angela

names.append('angela')

I recieved an error stating

File "<pyshell#45>", line 1, in <module>
names.append('angela')
AttributeError: 'tuple' object has no attribute 'append'

I did some research and found that because the list was not created with square brackets, that it would not work.
Why is that?

Jason-niws
Автор

for number in range(9, 30):
numbers.append(9, 30)


Traceback (most recent call last):
File "<pyshell#52>", line 2, in <module>
numbers.append(9, 30)
NameError: name 'numbers' is not defined

jureplazonic