Sri has Published 20 Articles

Difference between mutable and immutable in python?

Sri

Sri

Updated on 09-Sep-2023 09:42:39

2K+ Views

Python defines variety of data types of objects. These objects are stored in memory and object mutability depends upon the type, like Lists and Dictionaries are mutable it means that we can change their content without changing their identity. Other objects like Integers, Floats, Strings, and Tuples have no provision ... Read More

How many types of inheritance are there in Python?

Sri

Sri

Updated on 29-Jun-2020 11:16:47

374 Views

Inheritance is concept where one class accesses the methods and properties of another class.Parent class is the class being inherited from, also called base class.Child class is the class that inherits from another class, also called derived class.There are two types of inheritance in python −Multiple InheritanceMultilevel InheritanceMultiple Inheritance −In multiple ... Read More

Explain subn() methods of “re” module in Python ?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

2K+ Views

A regular expression is a special sequence of characters that helps you match or find other strings or sets of strings, using a specialized syntax held in a pattern. Regular expressions are widely used in UNIX world. The re module in python refers to the module Regular Expressions (RE). It ... Read More

How to get doc strings in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

229 Views

Doc strings is the documentation string which is string literal, and it occurs in the class, module, function or method definition, and it is written as a first statement.There are two types of a Doc strings:one-line Doc stringsmulti-line Doc stringsThese are mainly used in DataScience /Machine Learning Programming.one-line Doc stringsThis type of Doc ... Read More

How are arguments passed by value or by reference in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

11K+ Views

Python uses a mechanism, which is known as "Call-by-Object", sometimes also called "Call by Object Reference" or "Call by Sharing"If you pass immutable arguments like integers, strings or tuples to a function, the passing acts like Call-by-value. It's different, if we pass mutable arguments.All parameters (arguments) in the Python language ... Read More

What is the difference between del, remove and pop on lists in python ?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

404 Views

It does't matter how many lines of code you write in a program. When you want to remove or delete any elements from the Python list, you have to think about the difference between remove, del and pop in Python List and which one to useremove : remove() removes the first matching value ... Read More

How does Python's super() work with multiple inheritance?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

733 Views

Before going to explain super() first we need to know about multiple inheritance concept.Multiple inheritance : Means one child class can inherit multiple parent classes.In the following example Child class inherited attributes methods from the Parent class.Exampleclass Father:    fathername = ""    def father(self):    print(self.fathername) class Mother:   ... Read More

How To Do Math With Lists in python ?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

7K+ Views

We  not only use lists to store a collection of values, but we also use it to perform some mathematical calculations or operations to do.Example 1import math data = 21.6 print('The floor of 21.6 is:', math.floor(data))OutputThe floor of 21.6 is: 21How To Calculate the Weighted Average of a ListExample 2cost ... Read More

Is Python Object Oriented or Procedural?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

3K+ Views

Yes, Python support both Object  Oriented and Procedural  Programming language as it is a high level programming language designed for general purpose programming. Python are multi-paradigm, you can write programs or libraries that are largely procedural, object-oriented, or functional in all of these languages. It depends on what you mean by ... Read More

What is lambda binding in Python?

Sri

Sri

Updated on 30-Jul-2019 22:30:26

463 Views

When a program or function statement is executed, the current values of formal parameters are saved (on the stack) and within the scope of the statement, they are bound to the values of the actual arguments made in the call. When the statement is exited, the original values of those ... Read More

Advertisements