Category "for-loop"

python 3 how to generate multiple random element in list for loops

I'm doing a coding exercise and it's to build a password generator. I understand I need to utilize the for loop with the list containing the elements but I'm ha

Calculation between vectors in nested for loops

I am struggling with an issue concerned with nested for loops and calculation with conditions. Let's say I have a data frame like this: df = data.frame("a" = c(

Inserting multiple values into a string

I am trying to run this command but need to insert new two variables for every time I run this command. I think the right approach is to loop through a dictiona

Nested loop not iterating through entire list

I'm having a problem with my nested loop. I have a list of titles and a list of keywords, and I want to create a new list containing all of the titles that cont

Changing key name of a dictionary by comparing while keeping key value python

I have a dict with two strings "Candy-one" and "Candy-two" as the key and Capacity as the key pair. I wish to replace the strings "Candy-one" and "Candy-two" wi

Run setTimeout with changing time values

I have an array of objects containing a field duration that specifies the duration that the Object should stay visible. Each Object of array has it's own durati

The while loop inside the Python for loop is repeated only once

This is a part of the code that checks the notice that appears while working using pyautogui and resumes the work when it disappears. Capture the guide and make

How do I iterate over two lists?

I have troubles in using for loops in Python. I wrote this code: x=5 people=['Mary','Joe'] genders=['she','he'] for person in people: print(person) for

my copy array function didn't work. i didn't understand why

This code has to copy one array to another via void copy function. But I don't understand why it doesn't work. #include <stdio.h> void copy(int func_arra

How can I iterate through two lists in parallel?

I have two iterables in Python, and I want to go over them in pairs: foo = (1, 2, 3) bar = (4, 5, 6) for (f, b) in some_iterator(foo, bar): print("f: ", f,

How to use created functions argument inside the code?

When I create a function and use arguments as variable names in group_by() function there is error: comb <- function(z,x,y) { df <- z %>% group

Trouble with JavaScript 2D array and nested loop

Will you please explain what I'm missing? And possibly what I can do to fix it. I'm receiving the error: TypeError: Cannot set properties of undefined (setting

how to make repetitive request of the input?

I write this code to get the of digit of the number inputted by the user the problem I don't know how to make it repetitive to user to get the request of enteri

Why cant you subract a value from a for loop within an 2DArray but works vice versa(Adding a value to the 2DArray)?

Just like the game minesweeper I want the "O"s to change to "1"s if the borders are next to the "X"s, the board[i][j] will only change to "1"s if and only you a

How to find a missing value in an array? [duplicate]

I am trying to find the smallest missing element of an array using function check, which has two arguments (n and array A). I can't understand

Concatenating the output of a for loop

Y= zeros(3, 354) for m = 1 : 118 R=GridData.R2(:,3*m-2:3*m); X=GridData.X2(:,3*m-2:3*m); B=GridData.B1(:,3*m-2:3*m); G=GridD

Transform JSON into required format

Here is my input JSON [ { "date": { "value": "2022-05-01" }, "parent": { "value":

How to create a mosaic from different shapefile in R?

I have 37 shapefiles with different names.Individually each of them represent a different part of a country. I would like to create a mosaic of my 37 shp to jus

opencv bot Recursion Error using pyautogui , python-imagesearch, cv2

Im writing a bot using cv2 , pyautogui,and imagesearch libaries. in this function im searching for an image then I'm going to run another function when found if

Add word using sed to the last column of csv

I tried the following sed and even I have set $ to set the path at the end it doesn't seem to be working. Also I dont know if there's any way of execute this li