Found 33676 Articles for Programming

Building a Cryptocurrency Trading Bot with Python and the ccxt Library

S Vijay Balaji
Updated on 31-Aug-2023 18:06:53

5K+ Views

Cryptocurrency trading has become a popular investment option, and many traders are looking to automate their trading strategies with the use of trading bots. In this article, we will be exploring how to build a cryptocurrency trading bot with Python and the ccxt library. ccxt is a popular library for cryptocurrency trading and provides a unified API for multiple cryptocurrency exchanges. This makes it easy to switch between exchanges and automate trading strategies. We will be using Python to create a simple trading bot that can execute trades on Binance exchange. Getting Started Before we dive into using the ccxt ... Read More

Validating Indian vehicle number plate using Regular Expression

Shubham Vora
Updated on 27-Oct-2023 16:21:40

3K+ Views

In this problem, we will validate the Indian vehicle number plate using the regular expression. The regular expression is the search pattern created using the different characters, which we can use to match a particular pattern in the given string. Problem statement - We have given a string representing the Indian vehicle number plate. We need to use the regular expression to validate the given string. Sample Example Input: num1 = "GJ 03 AY 1097" Output: Yes Explanation - The given vehicle number plate is valid. Input: num2 = "TN 1A3 PZ 1287" ... Read More

Print Words with Prime length from a Sentence

Shubham Vora
Updated on 27-Oct-2023 15:24:33

698 Views

In this problem, we need to show all words of the string having the prime length. The logical part of the problem is getting the words from the string and checking whether its length is prime. We can check whether the length of the number is divisible by any number to ensure whether it is a prime number. Also, we will use the sieve of Eratosthenes and the wheel factorization algorithm to check whether the word length is a prime number. Problem statement − We have given a string alpha, and we need to print all words of ... Read More

Minimize operations to make String palindrome by incrementing prefix by 1

Shubham Vora
Updated on 23-Oct-2023 16:10:04

223 Views

In this problem, we will count the number of operations required by increasing the prefix characters of the given string. We will use character difference to count the minimum number of operations required to make string palindromic. Problem Statement We have given a string nums containing the numeric digits. We need to count a minimum number of operations required to convert a string into the palindrome. In one operation, we can select any prefix of the string and increment all prefix characters by 1. Sample Example Input nums = "22434" Output 2 Explanation ... Read More

Maximum number of Strings with Common Prefix of length K

Shubham Vora
Updated on 31-Aug-2023 18:22:33

213 Views

In this problem, we need to count the maximum string having common prefix of length K. We can take prefix of length K from all strings and count maximum number of similar prefix using the map data structure. Also, we can use the Trie data structure to solve the problem. Problem statement - We have given an strs[] array containing multiple strings. We need to count the maximum number of strings containing a common prefix of length K. Sample Example Input strs = {"tutorialspoint", "tut", "abcd", "tumn", "tutorial", "PQR", "ttus", "tuto"}; K = 3; Output ... Read More

Maximize value of Palindrome by rearranging characters of a Substring

Shubham Vora
Updated on 31-Aug-2023 18:18:39

265 Views

In this problem, we need to find the maximum palindromic string by rearranging the characters of any substring of the given string. We will use bitmasking to solve the largest palindromic substring. If any substring has bitmasking 0, it contains all characters even a number of times. So, we can generate a palindromic string using the characters of that substring, and we need to find the maximum palindromic string among them. Problem statement - We have given a string containing the N numeric characters. We need to find the maximum palindromic string by rearranging the characters of any ... Read More

Maximize sum by picking Array element to left of each ‘1’ of a Binary String

Shubham Vora
Updated on 23-Oct-2023 15:03:43

110 Views

In this problem, we will find the maximum sum of array elements by picking up unselected elements at the left from the current 1's index. We can use the vector list and sort() method to solve the problem or priority queue. The priority queue inserts the element in the sorted order. Problem Statement We have given a binary string alpha and arr[] of the same length. We need to pick all '1' of alpha one by one and take the maximum element which is not picked from the subarray of arr[] formed using 0 to p elements. Here, ... Read More

Make all Strings palindrome by swapping characters from adjacent Strings

Shubham Vora
Updated on 23-Oct-2023 14:54:49

698 Views

In this problem, we will make all strings of the given array palindromic by swapping the characters of the adjacent string. To solve the problem, we will try to make the character the same at p and str_len - p - 1 index in all strings, and it is only possible if overall characters at pth index and (str_len - p - 1) index is same. Problem statement - We have given an arr containing multiple strings of the same length equal to N. We need to count the minimum number of operations required to make all strings of ... Read More

Find Strings formed by replacing prefixes of given String with given characters

Shubham Vora
Updated on 20-Oct-2023 14:45:29

165 Views

In this problem, we will form a triangle from the given string. The triangle will contain the rows equal to the string length - 1, and in each row, we replace the starting characters equal to the row number with '.' Character. We can use the loop to form each row of the string or string constructor and substr() method. Problem statement - We have given a string alpha. We need to print the string in the triangle pattern. We need to start the triangle with the alpha string and replace the first character of the previous string ... Read More

Writing a crontab file in Python using the Plan Module

S Vijay Balaji
Updated on 31-Aug-2023 12:44:18

133 Views

First, let us understand what a crontab file is. Cron is a software utility that helps us schedule tasks on the Unix based systems. So basically, you’ll be able to periodically run assigned tasks, for example, automated system backups at the end of the day, to auto shutdown or set mode to DND at a particular time and more such features. These "tasks" in cron are usually defined in a file called crontab, which is basically a text file that contains the commands to be executed. Let us now learn how we can write these crontab files in Python using ... Read More

Advertisements