Roshan Book

My Tech Notebook

Python tutorial 6 lists and its methods


# List

# List Methods
# For the list
cast = [“Cleese”, “Palin”, “Jones”, “Idle”]
print (cast)

# finding length
print (len(cast))

# Print specific position value
print (cast[3])

# Append – adds to last of the list
cast.append(“Gilliam”)
print (cast)

# Pop- remove last item

cast.pop()

# Extend – adds multiple items at the end
cast.extend([“Gilliam”, “Chapman”])

# Remove – remove specific data

cast.remove(“Chapman”)

# Insert data to specific postion
cast.insert (0,”Chapman”)

 

Iterate (moving along each item) along list

fav_movies =[“manish”, “roshan”, “is”]

for each_item in fav_movies:

print(each_item)

# List inside list

movies=[“Tere Naam”, Hindi[“Marigold”, “Indian”]]

accessing value – print (movies[1][0])- output Marigold

Advertisements

6 responses to “Python tutorial 6 lists and its methods

  1. Discover an Australian Accent October 18, 2011 at 4:04 pm

    Plainly prefer to tell you the report can be as surprising. That picture quality in the submit is only amazing together with possible suppose you may be a guru in this particular content. Wonderful using your choice ok, i’ll to grab a person’s Feed to keep up to this point by using forthcoming future posting. Thank you an important zillion and additionally make sure you keep going any fulfilling work.

  2. Iraida Arbeiter October 22, 2011 at 12:32 pm

    Good post… Just killing some time rubbaging around and found your post. Great looking website. I will have to save the blog to come back. Cheers! My Blog: Lethalia Blogs

  3. Louis Vuitton Bags December 5, 2011 at 4:45 am

    Incredibly revealing thank you, It is my opinion your visitors may well possibly want way more posts like this maintain the remarkable effort.

  4. replica louis vuitton bags December 5, 2011 at 9:09 am

    I was wondering if this really is accurate, i’ve to alter my point of view. Due to the fact here in Germany, there are plenty of other opinions in this theory. Thanks a great deal for this brainer!

  5. LV Luggage December 6, 2011 at 9:39 am

    I honestly really should certainly pronounce, impressed along with your internet site. I had no difficulty navigating signifies all of the tabs also as associated information ended up being truly easy to complete to entry. I lately discovered what I hoped for prior to you realize it in any respect.

  6. canada goose December 10, 2011 at 7:49 pm

    The minute I saw your blog was like wow. We appreciate your putting your effort in some the next few paragraphs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: