Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: matrix number assignement to the random indices
Post: RE: matrix number assignement to the random indice...

(Feb-18-2022, 07:32 PM)deanhystad Wrote: I do not see purpose of tum or new_list. Essentially new_list is "not rassal". new_list has a use if you were doing this: row = [5]*COLUMNS for i in new_li...
juniorcoder General Coding Help 4 1,938 Feb-19-2022, 02:18 PM
    Thread: matrix number assignement to the random indices
Post: RE: matrix number assignement to the random indice...

Thank you so much @perfringo. I need two of the list. Imagine that we have list tum=[1, 2, 3,4,5,6]. For rassal I generated=[2,5,6] and so newlist will be new_list=[1,3,4].We have 4 rows , so matrix ...
juniorcoder General Coding Help 4 1,938 Feb-18-2022, 03:03 PM
    Thread: matrix number assignement to the random indices
Post: matrix number assignement to the random indices

Hello guys, I need a help with my python code and tell me what is wrong here. tum=[] for i in range(400): tum.append(i) rassal=[] rassal=random.sample(range(400), 200) ...
juniorcoder General Coding Help 4 1,938 Feb-18-2022, 02:06 PM
    Thread: Random data generation sum to 1 by rounding
Post: RE: Random data generation sum to 1 by rounding

Hello @deanhystad and @bowlofred and hello everyone, This time, I need to generate random values between 0 and 1 which are successively ordered but following normal distribution. Their sum will be ...
juniorcoder General Coding Help 9 3,444 Oct-20-2021, 09:41 AM
    Thread: Random data generation sum to 1 by rounding
Post: RE: Random data generation sum to 1 by rounding

(Oct-03-2021, 01:02 PM)deanhystad Wrote: To avoid 0 I would use random.sample(). It guarantees each value is unique. import random def random_divisions(n, total_size=100): values = sorted([0,...
juniorcoder General Coding Help 9 3,444 Oct-04-2021, 11:06 AM
    Thread: Random data generation sum to 1 by rounding
Post: RE: Random data generation sum to 1 by rounding

Thank you so much @Yoriz. It works well now. But, it deletes that 0.0 now completely and reduces the number of the index. For example , My array has to include 10 index. Since there is one 0 in one of...
juniorcoder General Coding Help 9 3,444 Oct-03-2021, 12:59 PM
    Thread: Random data generation sum to 1 by rounding
Post: RE: Random data generation sum to 1 by rounding

Thank you so much @Yoriz. It works well now
juniorcoder General Coding Help 9 3,444 Oct-03-2021, 12:27 PM
    Thread: Random data generation sum to 1 by rounding
Post: RE: Random data generation sum to 1 by rounding

Millions of thanks @bowlofredI have a small question about your solution. When I run your code, I get sometimes a list like this: Output:[0.05, 0.0, 0.11, 0.26, 0.02, 0.07, 0.03, 0.1, 0.07, 0.29]So th...
juniorcoder General Coding Help 9 3,444 Oct-03-2021, 10:46 AM
    Thread: Random data generation sum to 1 by rounding
Post: Random data generation sum to 1 by rounding

Hello everyone, I need a small help. I need to generate random values between 0 and 1. They must be successively ordered. Let me give you an example. Starting index is 3 and ending index 5, so in an...
juniorcoder General Coding Help 9 3,444 Oct-01-2021, 01:44 PM
    Thread: flipping the for loop in file
Post: flipping the for loop in file

Hello friends , I save the output of my python code in a txt. file . In this file I have many variables , like x[t][m]...y[t][m]...I[t][m]. For another code , 1)I need to read just x and y variables ...
juniorcoder General Coding Help 2 2,223 Oct-21-2018, 09:41 AM
    Thread: Break for While and For
Post: RE: Break for While and For

(Oct-16-2018, 11:43 AM)buran Wrote: Not tested but something like while True: random.randint() #I compute something else here ,but accordingly I might generate new random values if any(self.Itm[k][l...
juniorcoder Data Science 3 2,728 Oct-16-2018, 12:54 PM
    Thread: Break for While and For
Post: Break for While and For

Hello folks ; I have a small question . How can I apply "break" for "while " loop but if I have a for loop too ? Here is the example while True: random.randint() #I compute some...
juniorcoder Data Science 3 2,728 Oct-16-2018, 11:27 AM
    Thread: Small help for the python array save
Post: Small help for the python array save

Hello Folks , I need a small help . Here is my code: from random import randint X=[[8, 8, 8, 8, 6], [29, 27, 27, 27, 27], [9, 9, 9, 9, 10]] SaveX=X K=[] for t in range(5): a=randint(5,10) K.a...
juniorcoder General Coding Help 1 2,184 Sep-27-2018, 09:07 AM
    Thread: I need to add consecutive numbers help
Post: I need to add consecutive numbers help

Hello I have three numbers and I have to find minimum of them .k=min(a,b,c) No problem. After I need to add all the numbers until k to the another certain value Lets say k=5 so I need to add (1 2 3...
juniorcoder General Coding Help 1 2,347 Sep-17-2018, 11:32 PM
    Thread: Checking the elements of a matrix with an elements of a list
Post: RE: Checking the elements of a matrix with an elem...

(Sep-17-2018, 01:09 PM)volcano63 Wrote: Numpy arrays are intended to be used as objects - looping is wasteful and inefficient. This is how you can compare by rows and by columns Output:In [89]: tabl...
juniorcoder Data Science 11 5,910 Sep-17-2018, 01:32 PM
    Thread: Checking the elements of a matrix with an elements of a list
Post: RE: Checking the elements of a matrix with an elem...

But we do not know the content of list L=[5 10 5] I just gave an example like that: I should use the index of L to for the right hand side of inequlaity. and the other question how will I build the if...
juniorcoder Data Science 11 5,910 Sep-17-2018, 12:42 PM
    Thread: Checking the elements of a matrix with an elements of a list
Post: RE: Checking the elements of a matrix with an elem...

I had thought : if (a<=b and all(C[i][n]<=L[i]) for i in range(T)for n in range(N)): Do this but it did not work
juniorcoder Data Science 11 5,910 Sep-17-2018, 12:10 PM
    Thread: Checking the elements of a matrix with an elements of a list
Post: Checking the elements of a matrix with an elements...

Hello, I have an easy question. I have an matrix like C=[[1 2 3] [4 5 6] [7 8 9] and I have a list L=[5 10 5] I need to check if the elements of first line is less than 5 (L[0]), if the elements of ...
juniorcoder Data Science 11 5,910 Sep-17-2018, 11:03 AM
    Thread: if and for statements on the same line
Post: RE: if and for statements on the same line

Hello Buran , I have another similar question . This time I have an matrix like C=[[1 2 3] [4 5 6] [7 8 9] I need to choose second line [4 5 6] and check if each element is greater than 10. (check 4&...
juniorcoder General Coding Help 4 3,371 Sep-17-2018, 08:17 AM
    Thread: Checking the elements of a matrix with an elements of a list
Post: RE: Selecting a line of matrix on python

Hello thank you , but how can I read the third line of matrix one by one 12,13,14,15? what I am trying to do: if 12>a: do this if 13>b: do this etc
juniorcoder Data Science 11 5,910 Sep-16-2018, 03:16 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020