A Conditional Statements is a statement that checks for a Boolean condition. It decides whether the block of statement will execute or not. If the condition evaluates to TRUE a section of code will execute. There are various types of conditional statements in Python, let’s discuss one by one along with their syntax. Basic Syntax of Conditional Statements [conditional] : Any condition based on a combination of one or more… Read More »Conditional Statements in Python
Python is important for software development or machine learning. Compared to other programming languages, Python is great for a number of reasons.The elegant design and syntax rules of this programming language makes it quite readable even among multi programmer development teams. Lets Find out what are the things that makes Python stand out among programming languages. 1. Easiest Programming Language in the World Python is famous for its simplicity, readability… Read More »Advantages of Learning Python
Advantages of Learning Python
Problem Statement Write a function that reverse a string. Input string will be given as an array of characters char[]. Can you to it without allocating extra space for another array? Hint: You must do this by modifying the input array in-place with O(1) extra memory. You may assume that all the characters comprise of printable ascii character. Examples: Example 1: Example 2: Let’s see how to solve this question.… Read More »Optimized way to Reverse a String | Leetcode Challenge #344
Optimized way to Reverse a String | Leetcode Challenge #344
Longest repeated substring problem is a problem of finding the longest substring that occurs at least twice in a given string. This is also one of the important interview questions. Problem Statement Given a string S, consider all duplicated substrings: (contiguous) substrings of S that occur more than once. (The occurrences may overlap.) Return any duplicated substring that has the longest possible length. (If S does not have a duplicated substring, the answer is "".) Example 1: Input: “banana”, Output: “ana” Example… Read More »Longest Repeated Substring Problem
Longest Repeated Substring Problem
Slicing is extraction of a part of a sequence like list, tuple, string. It can fetch multiple elements with a single statement. It does not remove the values from the iterable; instead makes a new object with the desired elements. Syntax start – Starting integer where the slicing of the object starts. Default to None if not provided. end– Integer until which the slicing takes place. The slicing ends at index end – 1… Read More »A Complete Guide on List Slicing and slice() Method of Python
A Complete Guide on List Slicing and slice() Method of Python
The index() method is used to find the position of a particular element in the Python List. Since it is a method of list class, it’s called using a .(dot) operator on list. It checks every element from the starting of the list until it finds a match. The index in python is start from 0. Syntax Method returns zero-based index element in the list whose value is equal to x. … Read More »How to Get Index of an Element in Python List
How to Get Index of an Element in Python List
You might have noticed some times Microsoft Word automatically converts text into required fraction you need. But for most of the case, Word doesn’t do this magical conversion. It happens because, Ms Word has autocorrect feature enabled by default that convert commonly used fractions like 1/2, 1/4 and 3/4 to fraction characters like , and . However using this feature you can convert only a handful of fraction automatically. It… Read More »How to Type Fraction in Word: Tips and Tricks to Write Fractions
How to Type Fraction in Word: Tips and Tricks to Write Fractions
Python is famous for its elegant coding style that is concise, easy to write and almost as easy to read as plain English. List comprehension in python is one of the distinctive feature which provides a powerful functionality within a single line of code. It’s one of the advanced topic of Python that is very easy to learn, implement and practically useful. It makes your code concise, readable and boost… Read More »List Comprehension In Python
List Comprehension In Python
What is Web Scraping? In simple words, Web Scraping is an extraction of data from a website. For example, some websites contains an extensive amount of invaluable data like stock prices, product’s details and sports stats, so if you want to access their information, either you will copy or paste information manually or write a code (Web Scrapping) that automates it. Web scraping is also known as web data mining… Read More »Web Scraping using Python: Tutorial on how to extract data from website using Python
Web Scraping using Python: Tutorial on how to extract data from website using Python
Kadane algorithm is the fastest and optimized algorithm of Maximum Sum Subarray problem. Maximum sum subarray is the contiguous subarray within a given one dimension array with the largest sum. This problem is one of the classical interview questions in IT companies like Google, Apple, Amazon, LinkedIn, Facebook, Microsoft, Uber, and many more. For example, for an array, a = [-2, -4, 4, -2, -1, 1, 5, -7] A contiguous… Read More »Kadane algorithm for Maximum sum subarray problem: Java, Python and C++ code of Kadane algorithm