- 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
Rajendra Dharmkar has Published 452 Articles
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
2K+ Views
We are accustomed to using the * symbol to represent multiplication, but when the operand on the left side of the * is a list, it becomes the repetition operator. The repetition operator makes multiple copies of a list and joins them all together. Lists can be created using the ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
2K+ Views
To measure time elapsed during program's execution, either use time.clock() or time.time() functions. The python docs state that this function should be used for benchmarking purposes. exampleimport time t0= time.clock() print("Hello") t1 = time.clock() - t0 print("Time elapsed: ", t1) # CPU seconds elapsed (floating point)OutputThis will give the output −Time ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
121 Views
We can derive a class from multiple parent classes as follows −class A: # define your class A ..... class B: # define your class B ..... class C(A, B): # subclass of A and B .....We can use isinstance() function to ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
114 Views
We can derive a class from multiple parent classes as follows −class A: # define your class A ..... class B: # define your class B ..... class C(A, B): # subclass of A and B .....We can use issubclass() function to ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
265 Views
We have the classes A and B defined as follows −class A(object): pass class B(A): passExampleA can be proved to be a super class of B in two ways as followsclass A(object):pass class B(A):pass print issubclass(B, A) # Here we use the issubclass() method to check if B is subclass ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
166 Views
Inheritance in classesInstead of defining a class afresh, we can create a class by deriving it from a preexisting class by listing the parent class in parentheses after the new class name.The child class inherits the attributes of its parent class, and we can use those attributes as if they ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
524 Views
A class attribute is an attribute of the class rather than an attribute of an instance of the class.In the code below class_var is a class attribute, and i_var is an instance attribute: All instances of the class have access to class_var, which can also be accessed as a property ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
334 Views
The getattr() methodThe getattr() method returns the value of the named attribute of an object. If not found, it returns the default value provided to the function.SyntaxThe syntax of getattr() method is −getattr(object, name[, default])The getattr() method can take multiple parameters −The getattr() method returns −value of the named attribute ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
83 Views
Python delattr()The delattr() deletes an attribute from the object if the object allows it.SyntaxThe syntax of delattr() is −delattr(object, name)The delattr() method takes two parameters −The delattr() doesn't return any value (returns None). It only removes an attribute (if object allows it).Exampleclass Coordinate: x = 12 ... Read More
![Rajendra Dharmkar](https://www.tutorialspoint.com/assets/profiles/9963/profile/60_124173-1512724240.jpg)
Rajendra Dharmkar
138 Views
The setattr() methodThe setattr() method sets the value of given attribute of an object.SyntaxThe syntax of setattr() method is −setattr(object, name, value)The setattr() method takes three parameters −The setattr() method returns None.Exampleclass Male: name = 'Abel' x = Male() print('Before modification:', x.name) # setting name to 'Jason' setattr(x, ... Read More