Python Articles

Page 50 of 855

How to Find the average of two list using Python?

Pranavnath
Pranavnath
Updated on 27-Mar-2026 933 Views

Finding the average of two lists is a common task in data analysis and Python programming. Python provides several approaches including the statistics module, NumPy arrays, and basic arithmetic operations. Using the statistics Module The statistics.mean() function provides a straightforward way to calculate the average of combined lists ? import statistics # Initialize two lists numbers_1 = [56, 34, 90] numbers_2 = [23, 87, 65] # Combine lists and find average using statistics.mean() avg_of_lists = statistics.mean(numbers_1 + numbers_2) print("Average of two lists:", avg_of_lists) Average of two lists: 59.166666666666664 ...

Read More

Finding the Cartesian product of strings using Python

Pranavnath
Pranavnath
Updated on 27-Mar-2026 537 Views

The Cartesian product of strings creates all possible combinations between elements from different sets. Python provides several approaches to find the Cartesian product of strings using itertools.product(), nested loops, and lambda functions. Using itertools.product() The itertools.product() function provides the most straightforward way to generate Cartesian products ? import itertools # Define two sets of strings set1 = ["welcome", "all", "here"] set2 = ["see", "you", "soon"] # Generate Cartesian product using itertools.product() cart_product = list(itertools.product(set1, set2)) # Concatenate strings from each tuple result = [a + b for a, b in cart_product] print(result) ...

Read More

Python3 Program for Longest subsequence of a number having same left and right rotation

Shubham Vora
Shubham Vora
Updated on 27-Mar-2026 223 Views

In this problem, we will find the length of the longest subsequence of a given numeric string such that it has the same left and right rotation. A string has the same left and right rotation when rotating left by one position produces the same result as rotating right by one position. We can solve this problem using two approaches: generating all subsequences and checking rotations, or using an optimized observation-based method that recognizes patterns in valid subsequences. Problem Statement Given a numeric string, find the size of the longest subsequence that has the same left and ...

Read More

Python3 Program to Find Maximum number of 0s placed consecutively at the start and end in any rotation of a Binary String

Shubham Vora
Shubham Vora
Updated on 27-Mar-2026 289 Views

In this problem, we need to find the maximum sum of consecutive zeros at the start and end of any rotation of a binary string. We can solve this using two approaches: generating all rotations or using an optimized observation-based method. Problem Statement − Find the total number of maximum consecutive zeros at the start and end of any rotation of the given binary string. Examples Example 1 binary_str = "00100100" print(f"Input: {binary_str}") Input: 00100100 Output: 4 Explanation − Let's examine all rotations: 00100100 − Starting zeros: 2, ...

Read More

Python3 Program for Queries for Rotation and Kth Character of the given String in Constant Time

Shubham Vora
Shubham Vora
Updated on 27-Mar-2026 204 Views

In this problem, we need to perform queries on a string efficiently. We'll handle two types of queries: left rotation and character access. We'll explore two approaches - a straightforward string manipulation method and an optimized pointer-based solution. Problem Statement Given a string and an array of queries, perform operations based on query types ? (1, l) − Perform left rotation of the string l times (2, l) − Access and print the character at position l (1-indexed) Example Let's see how the queries work with a sample input ? # ...

Read More

Combining IoT and Machine Learning makes our future smarter

Mithilesh Pradhan
Mithilesh Pradhan
Updated on 27-Mar-2026 260 Views

The Internet of Things (IoT) creates networks of connected devices that collect data through sensors, while Machine Learning transforms this data into intelligent insights. Combining these technologies enables smart systems that can make autonomous decisions and adapt to changing conditions in real-time. What is IoT and Machine Learning Integration? The Internet of Things (IoT) consists of embedded devices, smart sensors, and computers that communicate through networks to collect and exchange data. These devices interact with the physical world using sensors for data collection and actuators for control operations. Machine Learning algorithms process the massive amounts of data ...

Read More

Gradient Descent in Linear Regression

Jay Singh
Jay Singh
Updated on 27-Mar-2026 1K+ Views

Gradient descent is a powerful optimization algorithm used to minimize the cost function in machine learning models, particularly in linear regression. It works by iteratively adjusting model parameters in the direction of steepest descent to find the optimal values that minimize prediction errors. Linear regression models the relationship between variables by finding the best-fit line, while gradient descent provides the mechanism to efficiently discover the optimal parameters for this line. Together, they form a fundamental building block of machine learning and predictive modeling. Understanding Linear Regression Linear regression models the relationship between a dependent variable and one ...

Read More

Training of ANN in Data Mining

Jay Singh
Jay Singh
Updated on 27-Mar-2026 751 Views

In the field of data mining, training artificial neural networks (ANNs) is extremely important. ANNs are powerful computer models that draw inspiration from the complex operations of the human brain. ANNs have revolutionized data science, machine learning, and artificial intelligence through their capacity to spot patterns, learn from data, and make predictions. Extraction of insightful information from large and complex datasets is what data mining involves. By training ANNs, data scientists can leverage the network's ability to uncover hidden patterns, spot trends, and create predictive models that can transform decision-making. Through training, ANNs adjust and optimize their internal parameters, ...

Read More

Pattern Evaluation Methods in Data Mining

Jay Singh
Jay Singh
Updated on 27-Mar-2026 6K+ Views

In data mining, pattern evaluation is the process of assessing the usefulness and significance of discovered patterns. It's essential for extracting meaningful insights from large datasets and helps data professionals determine the validity of newly acquired knowledge, enabling informed decision-making and practical results. This evaluation process uses various metrics and criteria such as support, confidence, and lift to statistically assess patterns' robustness and reliability. Let's explore the key pattern evaluation methods used in data mining. Understanding Pattern Evaluation Pattern evaluation serves as a quality filter in the data mining workflow, distinguishing valuable patterns from noise or irrelevant ...

Read More

How AI will Affect our Lives in the Next Decade?

Jay Singh
Jay Singh
Updated on 27-Mar-2026 356 Views

The development of computer systems that can carry out activities that traditionally require human intellect is referred to as artificial intelligence (AI). Learning, thinking, solving problems, and making decisions are some of these duties. AI covers a number of related disciplines, including computer vision, natural language processing, and machine learning. AI has altered several sectors and how people live and work. We can automate boring and repetitive jobs thanks to it, which boosts productivity and efficiency. Virtual assistants, recommendation engines, and personalized advertisements are just a few examples of the AI-powered technologies that have permeated our daily lives and ...

Read More
Showing 491–500 of 8,546 articles
« Prev 1 48 49 50 51 52 855 Next »
Advertisements