Python List.

0 26
Avatar for Vernardo
1 year ago

Python3 Article #0.6

A python list is like a brand of clothes house coffee or anything the list goes on.
In python if we want to create a list we need to assign the opening square bracket [ and closing ]

numbers = [1,2,3,4,5,6,7,8,9,10]
shoes = ['nike', 'adidas', 'puma', 'anta']

for n in numbers:  # We will use for loop to print every integers in numbers
    print(n)       # we need indentation for loop just press tab or space 3 times.

for s in shoes:    # We will use for loop to pirnt every brand of shoe in shoes list.
    print(s)       # Indentation.
family_tree = ['grandma','grandpa','mother','father','me','mybrother','mysister']
print(family_tree)
print(family_tree[0])
print(family_tree[4]) # me me me

We can also print the whole list in python or access just a certain object in a list we need to remember that python is zero based meaning the count start from zero in my_family tree the number one is grandma but we need to assign her to zero to access the first value we need to start from 0

Sponsors of Vernardo
empty
empty
empty

Applying all I have published.

my_name = 'PanPanHam'
my_age = 28
my_to_do_list = ['learn japan', 'learn korea', 'learn spanish', 'learn chinesse', 'be a bch millionaire']

for thing in my_to_do_list:
    print('My name is %s I want to %s I am %d years old' % (my_name, thing, my_age))

If you have any question or would like to know about a certain things that I didn't write on this article feel free to leave a comment below.


And that is all for this article Thank you for reading if I have any wrong grammar or misspelled words I decided to remove my grammarly so Sorry for that.

Leading Image


Disclaimer: Ideas and opinions presented in this article are solely based on my own experiences and knowledge no part of this article shall be plagiarist it is intended for educational purpose only.


My other social media where you can contact me for anything.

NoiseCash: noise.cash/@Vernardo

Telegram: @PanPanHam


PanPanHam

1
$ 0.00
Avatar for Vernardo
1 year ago

Comments