- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10783 Articles for Python
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
114 Views
Resources for any programming language includes Video Courses, Notes as well as E-books. Here, I will list the best resources of Python. Python Official Documentation A lot of websites are providing Python resources, but the official documentation still works the best. Let’s see the resources provided by them. Beginners Guide To Python − https://wiki.python.org/moin/BeginnersGuide Developer’s Guide To Python − https://devguide.python.org/ Free Python Books − https://wiki.python.org/moin/PythonBooks Python Standard Library − https://docs.python.org/3/library/index.html HOWTOs on Python −https://docs.python.org/3/howto/index.html Latest Talks on Python −https://pyvideo.org/ Python Resources Now, let us talk about the Python Resources except the official documentation. Following are some of ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
123 Views
To return an empty object, the object() method is used in Python. This acts as a base for all the classes. Let’s see the syntax of object(). No parameter gets included − object() New properties or methods cannot be added to this object. This itself acts as a base for all properties and methods, default for any class. Create an Empty Object Example In this example, we will create an empty object using the object() method − # Create an empty object ob = object() # Display the empty object print("Object = ", ob) Output Object = ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
124 Views
Separate tuple and list data types are provided because both have different roles. Tuples are immutable, whereas lists are mutable. That means, Lists can be modified, whereas Tuple cannot. Tuples are sequences, just like lists. The differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use parentheses, whereas lists use square brackets. Let’s see how Lists and Tuples are created. Create a basic Tuple Example Let us first create a basic Tuple with integer elements and then move towards Tuples within a Tuple # Creating a Tuple mytuple = (20, 40, 60, 80, 100) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
2K+ Views
To find the attributes of an object, use the getarr() method in Python. To check if an attribute exist or not, use the hasattr() method. Set an attribute using the setattr() method in Python. Access the attributes of an object Example To access the attributes of an object, we will use the getattr() method in Python − class student: st_name ='Amit' st_age ='18' st_marks = '99' def demo(self): print(self.st_name) print(self.st_age) ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
We can sort a list by values from another list by setting up the 2nd list as index numbers for the values in the 1st List in sorted order. Sort a List by values from another list Example In this example, we will sort a list by values from another list i.e. the 2nd list will have the index in the order in which they are placed in sorted order − # Two Lists list1 = ['BMW', 'Toyota', 'Audi', 'Tesla', 'Hyundai'] list2 = [2, 5, 1, 4, 3] print("List1 = ", list1) print("List2 (indexes) = ", list2) # ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
859 Views
Multidimensional Lists are Lists within Lists. The left index as row number and right index as column number, for example list[r][c] Above, r is row number and c is column number. Let’s see an example. For multidimensional list 2x3 − list [2][3] Create a Multidimensional Python List Example In this example, we will learn how to create a Multidimensional List in Python. We will also iterate and print the array. # Create a Multi-Dimensional Python List mylist = [[2, 5], [10, 24, 68], [80]] print("Multidimensional List") for outList in mylist: print(outList) Output Multidimensional List ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
849 Views
The arrays in Python are ndarray objects. To create arrays in Python, use the Numpy library. Array is a container which can hold a fix number of items and these items should be of the same type. To work with arrays in Python, import the NumPy library. First, let us first install the Numpy library − pip install numpy Import the required Numpy library − import numpy as np Create an Array Example Let us now create an array.. The basic Numpy Array is created using an array() function in NumPy − import numpy as np # Create ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
3K+ Views
To remove more than one item from a list, we can use various ways as discussed in this article. Let’s say have the following input List − ["David", "Jacob", "Harry", "Mark", "Anthony", "Steve", "Chris"] Following is the output when multiple elements “David” and “Harry” are removed − ["Jacob", "Mark", "Anthony", "Steve", "Chris"] Remove multiple items from a List Example To remove multiple items from a List, use the del keyword. The del allows you to add the items you want to delete in a range using square brackets: # Creating a List mylist = ["David", "Jacob", "Harry", "Mark", ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
368 Views
To remove duplicates from a List in Python, we can use various ways as discussed in this article. Remove duplicates from a list using Dictionary Example In this example, we will remove duplicates from a list using OrderedDict − from collections import OrderedDict # Creating a List with duplicate items mylist = ["Jacob", "Harry", "Mark", "Anthony", "Harry", "Anthony"] # Displaying the List print("List = ", mylist) # Remove duplicates from a list using dictionary resList = OrderedDict.fromkeys(mylist) # Display the List after removing duplicates print("Updated List = ", list(resList)) Output List = ['Jacob', 'Harry', ... Read More
![AmitDiwan](https://www.tutorialspoint.com/assets/profiles/123055/profile/60_187394-1565938756.jpg)
464 Views
Python Sequences includes Strings, Lists, Tuples, etc. We can merge elements of a Python sequence using different ways. Let’s see some examples of iteration over a List in reverse order. Iterate in Reverse Order using while loop Example In this example, we have a List as a sequence and iterate it in reverse order using the while loop − # Creating a List mylist = ["Jacob", "Harry", "Mark", "Anthony"] # Displaying the List print("List = ", mylist) # Length - 1 i = len(mylist) - 1 # Iterate in reverse order print("Display the List in Reverse order ... Read More