Python: Part Thirteen - Deepstash
Learning Python: Adding to a list

Learning Python: Adding to a list

So last time was about lists, and how to add elements to the list manually, but now lets look at adding a user but the user enters the info.

I have made a empty list, in this case i have done it very simply and asked the user and put that into a variable.

Once this is done then to add it to the list all we need to do is reference the list so in this case "user" and then followed by a full stop, from here you should see a list of different functions you could use, but in this case we are looking at the "Append". This will add the data in the variable to the list. print the list a have a look

1

35 reads

CURATED BY

samuelbancroft

Keep reading, keep studying, the more you learn the more you change. If you are doing the Python lessons please join this discord channel https://discord.gg/kugXx9KY but please follow the rules

CURATOR'S NOTE

Lesson 13/50, on the basics of python

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Access to 200,000+ ideas

Access to the mobile app

Unlimited idea saving & library

Unlimited history

Unlimited listening to ideas

Downloading & offline access

Personalized recommendations

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates