Skip to main content

Questions tagged [loops]

0 votes
0 answers
94 views

I want to share my invention, which allows you to use only one RegEx, which will search for substrings in a string with a certain condition. If you want, call it a RegEx loop that didn't exist before! ...
Raf's user avatar
  • 9
3 votes
2 answers
119 views

I've written a custom Live Search & Highlight function in vanilla JS. It is working and does what I expect it to. The issue is that the more items I add to the page content to search, the slower ...
codejp3's user avatar
  • 31
3 votes
1 answer
174 views

This code works great and does exactly what I want but it takes around 10 minutes for the code for find 150 lineups. I am hoping to get help and learn how to make it much faster. The goal of this code ...
safo2238's user avatar
1 vote
2 answers
174 views

Context: Write a program to print the output for the given input(Example is given in comments of my code). String is of odd length. I would be grateful if anyone could give feedback on my following ...
Silah's user avatar
  • 103
3 votes
1 answer
156 views

I use the below code to loop through a list of data and search through all the sub-folders in a given folder for files which match my requirements. Right now it takes this code about 22 minutes to run,...
J. DeSantis's user avatar
1 vote
1 answer
105 views

This post is modified from this one: https://codereview.stackexchange.com/posts/292885/edit (Alternatives to iterrow loops in python pandas dataframes). I have a piece of code to calculate price ...
Laura's user avatar
  • 81
6 votes
2 answers
748 views

I have a piece of code to calculate price sensitivity based on the product and its rating. Below is the original data set with product type, reported year, customer’s rating, price per unit, and ...
Laura's user avatar
  • 81
7 votes
5 answers
3k views

I'm just learning Python and am looking for some feedback on some of the code exercises I've completed and do work. In particular, what would make them more Pythonic, or more closely align with ...
Th1s0neGuy's user avatar
2 votes
1 answer
58 views

I'm trying to capture profits and set a stop loss in my trading strategy. I want the stop loss to be set daily based on the past data and if the current price, i.e., price for the date falls below the ...
driver's user avatar
  • 222
3 votes
1 answer
131 views

I want to replace a for loop with a break/return condition inside with a lambda. I think I have a good replacement, but I want ...
Oscar Besga Panel's user avatar
2 votes
1 answer
276 views

I was doing the Hackerrank "New Year chaos" problem. Here is the description: It is New Year's Day and people are in line for the Wonderland rollercoaster ride. Each person wears a sticker ...
user12138762's user avatar
3 votes
1 answer
162 views

I am trying to adapt an R script that I wrote to perform several tasks in a for-loop. The for-loop run over thousands of items, for about 900 times, therefore I would like to optimise my code at the ...
CafféSospeso's user avatar
3 votes
2 answers
367 views

I'm looking for a simple way to calculate the logarithm without using java.lang.Math, just out of interest. Here's my try (I adopted some code parts from this ...
Tobias Grothe's user avatar