Category: Python
Difference between iterables and iterators in Python
- Naveen
- 0
Iterables Iterators Iterators can be iterable because both iterator and iterable can be iterated using for loop but iterable objects can not be iterator because next() method is not supported by iterable objects. Popular Posts
Read MoreDecorators and Generators in Python
- Naveen
- 0
Python implementation Generators Python generators are functions that are similar to normal functions, but use yield statements instead of return statements. A generator function returns the generator object with a sequence of elements, which we can iterate over. Element in a generator object can be accessed either by using the next() function or using a…
Read MoreAbstraction in Python
- Naveen
- 0
Abstract Class Why Abstraction is Important? In Python, a person usually abstracts data/classes to hide the irrelevant information. This helps to reduce complexity and increase application efficiency. Abstract Base Classes An abstract class is the first part of a development interface that can be used to apply common features and behavior to several related subclasses.…
Read MoreOOPs in Python
- Naveen
- 0
Object-oriented programming (OOP) is a programming paradigm based on the concept of objects which contains data or attributes and code or methods. Major oops concepts include Class, Object, Inheritance, Polymorphism, Data Abstraction, Encapsulation. Class Class is the user defined data type and it is defined using class keyword. It is a collection of similar type…
Read MorePython functions, Parameters, Arguments, args and kwargs
- Naveen
- 0
Python functions A function is a construct that helps us perform some action using a block of code (the body of the function), sometime based on input parameters. These functions can take different forms and can do a lot to allow your functional code base to be effective, To define a function, you use the…
Read MoreList comprehensions, break-continue, exception handling in Python
- Naveen
- 0
As we have learned for loop to walk through a sequence, and do something with each item, at least read some value from it. There is a scenario, similar to what we saw with the last example in the for-loop introduction, that involves making a new list from the result of doing an operation on…
Read MoreTop 40 Data Science Interview Questions and Answers
- Naveen
- 0
1 – What is F1 score? F1 score is a measure of the accuracy of a model. It is defined as the harmonic mean of precision and recall. F1 score is one of the most popular metrics for assessing how well a machine learning algorithm performs on predicting a target variable. F1 score ranges from…
Read MoreHow to use if else, while and for loops in python?
- Naveen
- 1
The if and else clause are used to structure our code with checks for conditions. The if statement is followed by an expression that we use to express a condition, and delimiters the so-called if block. The block is executed if and only if the expression evaluates to True. Example 1: By the way, even…
Read MoreOperations in Python
- Naveen
- 0
There are many type of different operations using operators in the language: Identity As we manipulate values (using variable), two values can have the same identity. This can be tested using special built-in function: id(). We use is as the identity comparison operator, and the result here shows that var and the var3 have the…
Read MoreData types in Python
- Naveen
- 0
Now let’s discover data types that we can use to manipulate more data and do more things, such as lists, sets, and dictionaries. Lists A list is a sequence of arbitrary objects. You remember we said that strings are a sequence of (text) characters, so some of the things we already seen about strings apply…
Read More