Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 2 years ago. Improve this question
Tag: loops
Counting the number of triplets forming GP series in python
The problem statement is: You are given an array and you need to find number of triplets of indices(i,j,k) such that the elements at those indices are in geometric progression for a given common ratio, r and i<j<k. For example, arr=[1,4,16,64]. If r=4, we have [1,4,16] and [4,16,64] at indices (0,1,2) and (1,2,3). I have a solution but I am
Write a code to perform the same operation to multiple pandas DataFrames
I am trying to write a loop/definition to perform the same operation to multiple panda DataFrames. My aim is to get 5 pandas DataFrames with names a, b, c, d and e and to multiple of operations to them. What i get is “NameError: name ‘a’ is not defined”, and the new files are not written. I just can’t get
Call many python functions from a module by looping through a list of function names and making them variables
I have three similar functions in tld_list.py. I am working out of mainBase.py file. I am trying to create a variable string which will call the appropriate function by looping through the list of all functions. My code reads from a list of function names, iterates through the list and running the function on each iteration. Each function returns 10
How to repeat the steps
In my program I have total of 3 steps. To find the mean Split the given list using the mean value If the threshold value > epsilon then update mean value and repeat the step 2 again with updated mean value, else finished. I have achieved above two steps anyhow. Third step I have achieved only half and struggling in
Python dynamic for loop range size
I’m trying to add Link argument to ini file by using python. Example of ini file: I need to do like this: My for loop: My code works, but it does not add Link for last tags. I’ve found why. If I add in range(len(m)+100): Then code adds all Links. Looks like len(m) is old value (static?), because I’m increasing
Creating a palindrome checker with Python’s loop and if statements
I am trying to follow the instructions to create a palindrome. I am given half a function, and I have to fill in the blanks. I am currently unable to get the loop to work correctly. I am also unsure how to add characters to the beginning or the end of string without using the + or a comma. I
How do i loop over a geometric sequence. i need to loop some function over 1, 2, 4, 8, 16
My code is This is what the program looks like Answer With generators: Output:
Analysing height difference from columns and selecting max difference in Python
I have a .csv file containing x y data from transects (.csv file here). The file can contain a few dozen transects (example only 4). I want to calculate the elevation change from each transect and then select the transect with the highest elevation change. I’ve tried to calculate the change with pandas.dataframe.diff but I’m unable to select the highest
Need help to make while loop restart my Python program from top
I would like to get help with this program I have made. The function of the code is so the users can input a city anywhere in the world and they will then get data about the weather for that city. I want it to restart the program from the top, but it only restarts the program from where the