Skip to main content

All Questions

Tagged with
0 votes
1 answer
31 views

Went off the rails with a prime number Generator

I am doing a prime number generator for an assignment. I have been doing it most the day and am starting to think i got confused. It is intended to take an input and list all the numbers that are ...
Ian Schaak's user avatar
0 votes
2 answers
65 views

Reading file and list/tuple iteration

I need to take the data from a file, remove the lines that begin with a comment hash, then read that file into a list. Then convert that list into a list tuples of start times, end times, and step ...
user159's user avatar
  • 29
0 votes
0 answers
13 views

How can I take a list that isn't a set length, and use each item as an argument for a function? [duplicate]

I'm trying to find a way to take a list of integers and put each one as an argument of a function without knowing the length of the list. I have been trying to do things like join and such but that ...
HephMiner's user avatar
1 vote
0 answers
10 views

How to repeatedly insert arguments from a list into a function until the list is empty?

Using R, I am working with simulating the outcome from an experiment where participants choose between two options (A or B) defined by their outcomes (x) and probabilities of winning the outcome (p). ...
Mattias's user avatar
  • 11
1 vote
3 answers
401 views

Why isn't my function for getting the smallest value from a list working

I made a function for getting the smallest value from a list but it is not working properly and returning the wrong value. It prints out 5. What is wrong with it? def finding_least_num(a_list): ...
hershey10's user avatar
0 votes
1 answer
36 views

R: Remove Rows From Data Frame [i] of List 1 based on Index values from Data Frame [j] of List 2

I have the following problem: I have one list of data frames that includes a heart rate signal for each participant. Furthermore, I have a list of data frames which include the index values of ...
johnson24's user avatar
0 votes
0 answers
106 views

Printing list values asynchronously with multiprocessing Python

I am trying to print out all the possible outcomes of sets-sets3 values separated by elements with multi processing. The iterations tool gives out all the possible outcomes of the three values Lower,...
tony selcuk's user avatar
0 votes
0 answers
169 views

kdb: How to double-loop over a text file and extract the values, per line, per key?

I am working on question 4 of adventofcode. I have a list of strings called "q4" where there are 3 lines (just simple data for now) and each line has keys & values, such as: passport ID ...
JZL's user avatar
  • 53
0 votes
2 answers
715 views

random.choice() equivalent in order

I know using for loops display the items in a list in order, but it only displays them at once. e.g.: >>> list = [1,2,3,4,5] >>> for i in list: ... print(i) ... 1 2 3 4 5 Same ...
idkman's user avatar
  • 13
1 vote
4 answers
210 views

Python: Last index is not being iterated

I am working on a problem where I where I am given a list of duplicate numbers and I have to return a new list of all unique values from the initial list. Here is my solution: new_list = [1,1,1,1,...
Haider Khan's user avatar
0 votes
4 answers
70 views

A function that creates a lists with input from another function

I have a function that will run a couple of times (in a recursive function, so with a 'while' condition). Everytime it runs, it will return a certain integer. So for example, the first time it runs it ...
Mathbeginner's user avatar
0 votes
2 answers
158 views

How to iterate through a List function?

I'm running a test program where I make a list of strings and try to find which strings have a certain suffix or prefix. #include <iostream> #include <list> #include <string> using ...
bhl1994's user avatar
0 votes
2 answers
409 views

Matlab How to iterate a function through a list

I need some help iterating over a function that depends on two variables. So let's say I have a function that depends on two variables. Let's call it f = x + y Now, I have a two lists, one of x ...
Programmer's user avatar
0 votes
1 answer
27 views

Iterating through a list and passing each value to a function in Python

I have a list of IP addresses and I wish to use a Netmiko function to connect to each of these IP's in turn.. The function has IP as the first parameter, but I am not sure how to run through the ...
uberkind's user avatar
0 votes
0 answers
42 views

Iterating over a list to use in a function [duplicate]

I have a function that calculates the volume of a cone. def volume(zmin,zmax): #calculate volume using some calculations However for the zmin, zmax arguments, I would like to give a list of ...
Srivatsan's user avatar
  • 9,363

15 30 50 per page