Skip to main content

All Questions

Tagged with
0 votes
2 answers
124 views

For a custom Mapping class that returns self as iterator, list() returns empty. How do I fix it?

The following is a simplified version of what I am trying to do (the actual implementation has a number of nuances): from __future__ import annotations from collections.abc import MutableMapping ...
fishfin's user avatar
  • 293
1 vote
3 answers
135 views

Using tidyverse to loop or iterate my dataframe to replace all values before the a first specific value and after a specific value

I'm working with psychological tests composed of 10 gradually increasing items. Scores can be 0 (wrong), 1 (almost correct), or 2 (correct answer). So, question 2 is harder than question 1. Question 3 ...
Luis's user avatar
  • 1,584
1 vote
1 answer
462 views

What are the main ways to do a reverse iteration in Nim?

I'm learning Python. I recently learned about Nim and began to study it too. I liked the python+pascal syntax and the speed of C. Unfortunately, there is much less educational information and ...
Lucius_Will's user avatar
0 votes
1 answer
100 views

How to iterate backwards with a custom iterator in Java using permutations

I am trying to create a a class of Permutation that extends Iterator and adds two methods: previous() and hasPrevious(). It must offer a constructor with one argument: a string containing the ordered ...
Kate Johnson's user avatar
0 votes
1 answer
523 views

kdb/Q How to iterate on a function x number of times?

I'm new to kdb/Q, what is the equivalent of iteration, where I need to run a function 10 times? In Python, it would be something like creating some kind of iterator, using a while loop to run the ...
mmv456's user avatar
  • 23
0 votes
4 answers
2k views

TestDome - Malware Analysis in C++

I'm practicing this problem on TestDome, and I found myself stuck with the final step of the malware process, namely, replacing the correct position with a value of 0. My program accurately prints out ...
RexyCode's user avatar
1 vote
1 answer
65 views

creating a function looping through multiple subsets and then grouping and summing those combinations of subsets

I am attempting to build a function that processes data and subsets across two combinations of dimensions, grouping on a status label and sums on price creating a single row dataframe with the ...
JLuu's user avatar
  • 373
0 votes
1 answer
58 views

Looping through combinations of subsets of data for processing

I am processing sales data, sub-setting across a combination of two distinct dimensions. The first is a category as indicated by each of these three indicators ['RA','DS','TP']. There are more ...
JLuu's user avatar
  • 373
0 votes
1 answer
233 views

KDB+ Q Create a looping/iteration id column

I have a kdb/q question I would like some help with. Please see the table below `A B Run 99 newcol Start 99 newcol Start 99 newcol Start 99 newcol During 99 newcol During 99 newcol End ...
user avatar
0 votes
2 answers
170 views

Iterate over multiple elements at once Python [duplicate]

If I have a list like l=[1,2,3,4,5,6]. If I do something like: for i in l: print(i) It will print all element separately. 1 2 3 4 . . . Is there a way to iterate simultaneously over multiple ...
Will's user avatar
  • 1,855
0 votes
0 answers
43 views

how to iterate over firestore document id in flutter

I have returned all the IDs of my firestore documents, and now I need to get the index of each one. Until now I get an error: "Spread elements in a list or set literals must implement 'Iterable' &...
Giovanni's user avatar
  • 595
2 votes
3 answers
77 views

If True: turn following values to True in list of booleans until nth position after True is reached

I have a list of booleans l = [False, False, False, True, False, False, False] that I want to turn into l_new = [False, False, False, True, True, True, False] That means, whenever there is a True in ...
Fabian Pascher's user avatar
3 votes
1 answer
783 views

Kotlin: loop through finite values returned by a next function

Background info A common pattern in some programming languages is to have a function that when called, returns the next value until the end of the finite sequence is reached, in which case it keeps ...
Devabc's user avatar
  • 5,361
1 vote
2 answers
47 views

Iterate through a function until exact value or certain range is reached

I have a function that takes gross income as input and gives me the net income as output: gross_net <- function(gross_income, social_security = 0.2, tax =...
r-newbie's user avatar
  • 159
0 votes
0 answers
31 views

How to iterate over a dataframe that's processed in another function? [duplicate]

I want to use the reactome2py package to analyse pathways by adapting the Reference code. I want to iterate over the dataframe (e.g., df for data_linear_cna.txt). Reference code: https://colab....
Anon's user avatar
  • 1,545

15 30 50 per page
1
2 3 4 5
16