Category "for-loop"

For and if in gnuplot

I have a little problem, I need to join the for loop with the if condition to graph different functions quickly, here I leave the prototype code reset set termi

extract attributes from span

I have a lxml file and I need content from there. The file structure looks like this: <span class="ocr_line" id="line_1_1" title="bbox 394 185 1993 247">

For Loop in R to find duplicates in single vector WITHOUT built-in functions

I found this as an interview question and can't seem to work a solution. You can't use any built in R functions. x <- c(77, 12, 4, 8, 77, 2, 4, 12) answer &

Can someone help me fix the bottom two rows of my nested loop? They shouldn't be the same lengths, but they are

I'm working on a project where I'd like to create the following pattern: X XX XXX XXXX .. and so forth. There are twenty rows in all, and the twentieth row sho

How to create multiple dataframes from a single large dataframe using for loop

I have a large dataframe I need to split into many smaller dataframes: import pandas as pd from numpy import rec, nan a = rec.array([(201901L, 'markers', '

How to print result in one line [duplicate]

I am trying to solve a problem with this code: equipoa = input("Digite las iniciales del equipo a: ") equipob = input("Digite las iniciales de

In C++ printing even, odd and prime number by using for loop and typeinfo method [closed]

I am trying to print even, odd and prime numbers in one program b/w 1 to 1Lac. I have already printed even and odd numbers but don't how to pr

How to create a for loop that reads each character in ksh

I'm unable to find any for loop syntax that works with ksh for me. I'm wanting to create a program that esentially will add up numbers that are assigned to lett

How to use as_hms in a for loop in R

I have multiple csv files with the columns "timestamp" and "users_holding" I was able to split the timestamp column into two columns "Date" and "Time". I am now

How can I iterate a for loop in Python in the increments of sum of another variable and iterator

I am trying to make a python program for "The Sieve Of Eratosthenes" but I am stuck at one place. The c program I wrote looks something like this : for (i = 2;

Why "for i in q" makes the result different from "for i in range(len(q))"?

I have code for calculating max depth using BFS, which works fine, but I couldn't figure out why it fails if I replaced for i in range(len(q)): with for i in q:

Problem by using for loop when loading data series from .csv file and save them as array matrix for every columns loaded

I want to load a series of data from 6 CSV files and save them per column of the data series. As I call the Column_A, Column_B and new_Column_A, only the last o

Python multiplication table school exercise

I have a school exercise, but im struggling to understand how to do the multiplication table. Could someone please help me? So depending on the number and colu

How can i make for loop a recursive method

How can I make this code a recursive method? for (int i = 3; i < arr.length; i++) { writer.write(arr[i] + "\n"); strout += arr[i] + "\n"; }

Why for in loop returns string instead of my object? [duplicate]

i have nested object: var obj = { nestobj1:{ title: "some 1 title", text: "some text" }, nestobj2:{ title

lines repeat in List python

I need your help with the next problem, i need that a python recieve an string "EEEEDDSGES" and the output would by the sum of charactes that repeat in line, E

r behaves strangely copying eigenvectors to a matrix in a for i loop

I'm a bit confused. A matrix A has 8 eigenvalues, some of them are complex, some are real. I want to copy only the eigenvectors that correspond to the real eige

Matrix index out of range during loop

a is an nxn matrix. I have this code: [m,n] = size(a); x = zeros(m,1); for j=1:1:n if(j==1) a(1,:) = []; else end disp(a); a(:,j) =

dynamically get columns from 2D array

I have a 2D array of row,through which i want get the column coordinates/information just like i got for the row(rowArr2D) So,in my Column(colArr2D) i'm just ge

My for loop won't output anything (Matlab)

I'm trying to get this for loop to work on Matlab so I can plot these three histograms. I'm guessing it won't output because it says that my variables such as a