Found 26504 Articles for Server Side Programming

How to Print the Last Word in a sentence using Python?

Nilesh Kumar
Updated on 04-Oct-2023 17:00:12

1K+ Views

Introduction This article will be focusing mainly on how to print the last word in a sentence using Python. We will be using a simple technique to achieve the task. Python is an open-source, flexible, powerful programming language that provides us with various modules and functionalities that helps us to manipulate strings easily. For printing the last word in a sentence, we will use Python’s built-in string functions. Our approach is that we will first break down the input sentence i.e., given input string into a list of words and access the last element of the list to obtain the ... Read More

How to Print a Heart Pattern Using Python?

Nilesh Kumar
Updated on 04-Oct-2023 16:57:24

4K+ Views

Introduction In this article, we are going to focus on how to print a heart pattern using Python. We will look into the syntax of the function that is going to be used in the code. We will also learn about the method definition and the arguments that the method will take and their purpose. As we all know python is an open-source versatile programming language that provides a huge number of modules and functionalities to accomplish our task. with Python's simplicity and readability, we can transform our computer screen into a canvas with just a few lines of code. ... Read More

Clustering Methods with SciPy

Pranay Arora
Updated on 04-Oct-2023 13:46:13

250 Views

Clustering is a technique in machine learning and data science that involves grouping together similar data points or objects into clusters or subsets. The goal of clustering is to find patterns and structures in data that may not be immediately apparent, and to group related data points together which can be used for further analysis. In this article, we are going to see how to implement clustering with the help of the SciPy library. SciPy provides us with various scientific computing tools to perform tasks like numerical integration, optimization, linear algebra, signal processing etc. It's used by researchers, scientists, engineers, ... Read More

Building Chatbots in Python

Pranay Arora
Updated on 04-Oct-2023 14:02:39

568 Views

A chatbot is a computer program designed to simulate conversations with human users via text or voice. It uses AI and NLP techniques to help understand and interpret user’s messages and provide relevant responses. In this article, we will see how to create a chatbot with the help of Python. Chatbots like chatGPT have become popular since the end of 2022 and have a wide-scale use case for people of different fields. Chatbots are also integrated with mobile apps like Swiggy and Zomato to provide faster resolution to customer complaints. Chatbots are of multiple types which are as follows: ... Read More

Modelling Two Dimensional Heat Conduction Problem using Python

Dr Pankaj Dumka
Updated on 04-Oct-2023 11:28:48

3K+ Views

In this tutorial, we will see how to model 2D heat conduction equation using Python. A 2D, steady, heat conduction equation with heat generation can be written in Cartesian coordinates as follows − $$\mathrm{\triangledown^{2} T \: + \: \frac{q_{g}}{k} \: = \: \frac{\partial^{2}T}{\partial x^{2}} \: + \: \frac{\partial^{2}T}{\partial y^{2}} \: + \: \frac{q_{g}}{k} \: = \: 0 \:\:\dotso\dotso (1)}$$ This has to be discretized to obtain a finite difference equation. Let us consider a rectangular grid as shown below. The index 𝑖 runs vertically i.e. row wise whereas the index 𝑗 runs horizontally i.e. column wise. Any inside node ... Read More

Modelling the Taylor Table Method in Python

Dr Pankaj Dumka
Updated on 04-Oct-2023 11:26:07

384 Views

The Taylor Table method is a very efficient and elegant method of obtaining a finite difference scheme for a particular derivative considering a specific stencil size. To understand it one should be very much clear about what is a stencil. Suppose one wants to evaluate $\mathrm{\frac{d^{2}f}{dx^{2}}}$ then in finite difference method the starting point is the Taylor series. Consider the figure shown below for a better understanding of the method. The Taylor series expansion at the point $\mathrm{x_{i} \: + \: h}$ will be: $$\mathrm{f(x_{i} \: + \: h) \: = \: f(x_{i}) \: + \: hf'(x_{i}) \: + ... Read More

What are different types of Tries?

Sonal Meenu Singh
Updated on 04-Oct-2023 08:17:51

5K+ Views

Introduction In this tutorial, we will understand different types of tries and their uses. Tries are tree-like data structures that are mostly used for operations like string searching. There are various types of trie and they are used as per the task requirement. Generally, trie tries are of three types: Standard trie, compressed trie, and suffix trie. We elaborate on the meaning of each type of trie. What is Trie A trie is a sorted binary tree also called a digital tree or a prefix tree. It has nodes that are used to store data or alphabets. Each node can ... Read More

How to sort the string based on the number of matchsticks for representation?

Sonal Meenu Singh
Updated on 03-Oct-2023 18:56:27

131 Views

Introduction In this tutorial, we implement an approach to sort a string on the basis of the number of matchsticks required for its representation. In this approach, we use N numbers of matchsticks and sort an array. The array can contain numbers, words, or both. Matchsticks are used to arrange them in the shape of a particular number or character. Demonstration 1 Input = Arr = ["1", "3", "4"] Output = The sorted array is 1 4 3 Explanation In the above input array, the array elements are 1, 3, and 4 Number of matchsticks required for ... Read More

How to alphabetically sort an array while converting numbers into words?

Sonal Meenu Singh
Updated on 03-Oct-2023 18:54:31

202 Views

Introduction This tutorial deals with the problem of sorting an array alphabetically while each number is converted into words. To translate numbers into words means changing numbers to their number names. Like, 65 is sixty-five. Here, we consider a numerical array, convert all array elements to words and arrange them alphabetically. Print the sorted array elements after converting words to their respective numbers. Demonstration 1 Input = Arr = {13, 1, 6, 7} Output = 1 7 6 13 Explanation The input array elements are 13, 1, 6, 7 The output with alphabetically sorted elements is 1 7 ... Read More

Range Update Queries to XOR with 1 in a Binary Array

Sonal Meenu Singh
Updated on 03-Oct-2023 18:52:33

165 Views

Introduction In this tutorial, we find an approach to find the range update Queries to XOR with 1 in a binary array. To implement the approach we use a binary array which is an array consisting of 0 and 1. The range update queries are the queries which are used to modify the binary array within the given upper and lower limit of a range. The upper and lower limits are the index of binary array elements. The elements lying in that range are updated with defined operations. XOR is one of the bitwise operations standing for exclusive OR. Its ... Read More

Advertisements