GK SCIENTIST

General Knowledge One Stop Source
Menu
  • Home
  • Social Science
    • History
    • Political Science
    • Geography
  • Science
    • Physics
    • Chemistry
    • Biology
  • Chemistry Notes
  • Mathematics
  • Computer
  • Tutorial MySQL
  • Tutorial Python
  • Java Tutorial
  • English Grammar
  • English Essay
  • Indian Anthropology
  • Philosophy
  • Solved Paper
  • UPSC
  • Current Content
    • Current Affairs
    • RSTV News
    • Yojana and Kurukshetra Gist
  • Donate
  • Contact Us

If you are interested in advertising to our audience, submit the advertising enquiry form.

Advertising Enquiry
Computer

Python List Function

Gk Scientist November 27, 2022 No Comments
Tweet WhatsApp Telegram

Python List Function:

We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it.

(1) del– The keyword del can remove a specified item from the list using items indexed number.

del function python - Python List Function

(2) pop()– Returns the element whose index is passed as a parameter to this function and also removes it from the list. If no parameter is given, then it returns and removes the last element of the list.

pop method in python - Python List Function

The pop() method returns the removed value as shown below.

pop method return removed value - Python List Function

(3) remove()– Removes the given element from the list. If the element is present multiple times, only the first occurrence is removed. If the element is not present, then ValueError is generated.

remove method python - Python List Function

(4) clear()– The clear() function can be used to clear items from a list.

clear function in python - Python List Function

(5) Update Element From List– By using this function you can update any value in the list by using the index number.

Update Element From List Python - Python List Function

(6) insert()– Inserts an element at a particular index in the list.

insert function in python - Python List Function

(7) append()– Items can be added to the end of a list using the append() function.

python append function 1 - Python List Function

Another example is shown below-

append function in python - Python List Function

(8) extend()– Items from one list can be appended to another list using the extend() function.

python extend function - Python List Function

(9) zip()– The zip function takes two lists and “zips” them together, matching the first item from the list1 with the first item from the list2, and so on.

python zip function - Python List Function
  • Note: If one list contains more values than the other list. In that case, the zip function returns only the same number of values ignoring the extra value in the list, as shown below.
zip function in python - Python List Function

Another method to Iterate Two Lists:

Iterate Two Lists in python - Python List Function

List Comprehension in Python
List Iteration in Python
String Iteration in Python
String Indexing and String Slicing in Python
Python Identity Operators
Python (programming language)– Wikipedia
Prev Article
Next Article

Related Articles

Create MySQL Database and Connection in Python
Create MySQL Database and Connection in Python: In the previous …
Gk Scientist December 11, 2022 Computer

Create MySQL Database and Connection in Python

Java KeyListener
Java KeyListener: We can use the Eclipse IDE for this …
Gk Scientist January 18, 2023 Computer

Java KeyListener

Python User-Defined Function
Python User-Defined Function: We can use the PyCharm code editor …
Gk Scientist December 2, 2022 Computer

Python User-Defined Function

Python While Loop
Python While Loop: We can use the PyCharm code editor …
Gk Scientist November 24, 2022 Computer

Python While Loop

Java Nested Loops
Java Nested Loops: We can use the Eclipse IDE for …
Gk Scientist January 2, 2023 Computer

Java Nested Loops

MySQL IN Operator
MySQL IN Operator: (1) In MySQL, the IN operator is …
Gk Scientist November 12, 2022 Computer

MySQL IN Operator

Java FileReader Class
Java FileReader Class: We can use the Eclipse IDE for …
Gk Scientist January 14, 2023 Computer

Java FileReader Class

Java Overloaded Constructors
Java Overloaded Constructors: We can use the Eclipse IDE for …
Gk Scientist January 8, 2023 Computer

Java Overloaded Constructors

Leave a Reply Cancel Reply

Search




  • Popular
  • Recent




GK SCIENTIST

General Knowledge One Stop Source

Information

  • About Us
  • Terms and Condition, Disclaimer
  • Contact Us

Android Apps

  • IAS App For English Medium Students
  • IAS Basics App For English Medium Students
  • IAS Hindi App For Hindi Medium Students
DMCA.com Protection Status

Popular Tags

Biology (33) Biology Questions (88) Chemistry (57) Computer (214) Current Affairs (4) Current Content (0) Economy (10) English Essay (172) English Grammar (75) English Literature (10) Geography (83) History (259) Indian Anthropology (11) Indian Polity (14) JKAS Mains Question Papers (17) Mathematics (68) Moral Science (7) NCERT & Other Boards Books (25) Philosophy (114) Physics (89) Political Science (132) RS TV News (33) Science (553) Social Anthropology (7) Social Science (17) Solved Paper (47) UPSC (7) UPSC Mains Question Papers (26)

Downloads

  • NCERT Books
  • Old NCERT Books
  • NIOS Books For IAS, SSC, and State PSC Exam
  • Tamil Nadu Board Books: Important For UPSC, SSC, and State PSC Exam
  • Modern Indian and World History Notes For IAS Exam
  • UPSC Topper 2013 Gaurav Agrawal Notes For IAS Preparation
  • UPSC IAS Prelims General Studies – Previous Year Papers
  • UPSC Mains Question Papers

Copyright © 2023 GK SCIENTIST
Theme by MyThemeShop.com& Hosted On Cloudways

Ad Blocker Detected

Our website is made possible by displaying online advertisements to our visitors. Please consider supporting us by disabling your ad blocker.

Refresh
 

Loading Comments...