Category "for-loop"

How to loop over on different files and save the output with filename in R?

I have several files with the names RTDFE, TRYFG, FTYGS, WERTS...like 100 files in txt format. For each file, I'm using the following code and writing the outpu

change even character in string with the for loop

hello everyone please i'am a begginer in javascript and i found this challenge , but i don't know how to solve it let str1 = "javascript"; // Example output:

My for loop breaks and repeats the output over and over, also I cannot use Dictionaries in this

My code is a WW2 fact machine and for example if you input "1939" the code should print "start of war". If you input a keyword like "Dunkirk" it should work the

Naive reverse string iteration infinite loop and/or assertion failure C++ / Visual Studio 2022

I am trying to reverse iterate through a string, but am getting assertion failure for the [] operator in the latest VS. int foo() { std::string s = "s";

Longest Common Prefix in Javascript

I am trying to solve the Leet Code challenge 14. Longest Common Prefix: Write a function to find the longest common prefix string amongst an array of strings.

Problems with a for loop using writeRaster

I am trying to create a for loop to merge 4 raster (EVI MODIS tiles) at a time (because the 4 raster create one big map) in a list of 8 raster (my real list is

Subset df by N rows having Timestamps in Python

I have a long dataframe from which I want to subset a range of rows (size = 60) and do some operations using for-loop iteration. If not the above, based on the

how to print prime numbers using for loop in shell script

I want to print prime numbers using for loop in shell script. Please provide some suggestions. actually I could able to print odd numbers from range of 1 to 10

why are my first and second LED not lighting up? is it a problem with the for loops?

When I power my Arduino it only lights up the 2-5 and leds and skips the 1st and the 6th led. I tried seeing what's the problem by giving a check on the value o

Pause a for loop, save progress and resume it another time?

In python(3) I'm coding a script which uses a recursive for loop (the for loop calls it's own function various times) and I know the script will only finish aft

How do I create a list containing new data frames from an existing data frame?

I have a csv file containing 5 columns, 225 rows containing my data. The columns pertain to the experiments' Subject_ID, treatment (9 types), replicate(5), time

python - remove space in the end of range loop (int)

Its quite simple but I got stuck. I have two files who need to be identical(even spaces) file #1 is the output from : for i in range(0, 19): print(i)

For loop only reads the last line of the text file

I have a simple login program where I need user to input the correct details to proceed ,This is my code: email_l = [] pass_l = [] f = open("lab6.txt", "r") con

passing a filename as a parameter from a for loop in python flask

I am uploading file so i am trying to pass a filename after looping through but i am getting an unbountLocalerror. i have tried making the filename global so th

Create a procedure to fill a new table

I am new to PostgreSQL and am struggling with the creation of a procedure to save the data in a new table. This is how the empty table is created CREATE TABLE e

Code in Python that count repeated elements and return the item repeated most times and how many times

I have a list with integers, I need to find which item repeat the most, then the function should return two variables (value, number) value is the repeated elem

iterating different length arrays and replace values

I have a dataframe that looks like this: df = pd.DataFrame({'col1': [[[1,5,3],[0,0,0]], [[1,2,3],[0,0,0], [1,2,3]]]}) # which looks like this: col1 0 [[1

File name pattern matching in Windows command line

I have several files like: a.txt a$.txt a$b.txt b.txt b$.txt b$c.txt I would like to print file whose name does not contain '$' using Windows command line fo

Summing NAs in each row in a new column

for (i in 1:nrow(survey_clean)) { for(j in 1:ncol(survey_clean)) { survey_clean$invalid_answers[i] <- sum(survey_clean$old_col == survey_clean$ol

Return True if any number is even inside a list else return false

I am new to Python. I am doing some exercise online. def user_input_checking_even_number_list(user_input_list): for input_number in user_input_list: