Questions tagged [non-repetitive]
57 questions
1
vote
1 answer
Repetitive value assignment with computation
I have some TS code that I'm not happy with. I'im doing three times the same thing. How could this be cleaner?
A position object has an x, y and z axis that can be set with position.x = ... or give it all the values with position.set(x,y,z).
Could I…

Thhollev
- 73
- 1
- 1
- 10
1
vote
3 answers
Unique combinations of 0 and 1 in list in prolog
I have problem, because I want to generate permutations of a list (in prolog), which contains n zeros and 24 - n ones without repetitions. I've tried:findall(L, permutation(L,P), Bag) and then sort it to remove repetitions, but it causes stack…

lolos
- 37
- 1
- 5
1
vote
1 answer
extract (from text) only non-repeating words using only regex via shell terminal
I just want to extract the words that don't repeat over the text below. I just want to use regex, and I have seen some similar questions as in Only extract those words from a list that include no repeating letters, using regex (don't repeat letters)…

7beggars_nnnnm
- 697
- 3
- 12
1
vote
5 answers
How to generate a list of to repetitive items with different frequency?
I want to generate a list of strings shown below:
['EEG', 'EEG', 'EEG', 'EMG', 'EMG', 'EOG']
but, for example, with 32 'EEG' items and 2 'EMG' and one 'EOG'.
How could I do that in one line?
I have read a StackOverflow post and I know a single…

Mohammad Javad
- 172
- 17
1
vote
1 answer
Assigning colors to data
Is there a productive way to assign a color to an element by considering the value passed, without repeating the code to every component?
For example I have this:
If value :'high' text color should be red.
If value :'low' text color should be…

SGhaleb
- 979
- 1
- 12
- 30
1
vote
4 answers
Java: how to count non-repeated (occurring only once) Strings in ArrayList?
I am trying to find the number of Strings that only appear exactly once in an ArrayList.
How many I achieve this (preferably with the best possible time complexity)?
Below is my method:
public static int countNonRepeats(WordStream words) {
…

Iona
- 169
- 1
- 4
- 12
1
vote
3 answers
Array empty in a Non repeating algorithm for random numbers in Xcode with arc4random
I've a problem with the generation of random values with arc4random in Xcode. I want to exclude from the random generation those number that are already picked up. This is the algorithm that I've wroten
int randomValue = (arc4random() %…

TheInterestedOne
- 748
- 3
- 12
- 33
0
votes
1 answer
Avoid email flood. in Python Alerting
I have a script which will send email if the task is not in running status. This script runs every 5 min.
for task_list in status['tasks']:
if task_list['state'] != 'RUNNING':
…

oraclept
- 29
- 1
- 5
0
votes
0 answers
Random questions without repetition python kivy
I am on my way to build a quiz app, the questions and answer options are in a image displayed in a screen. Each question have theyr own screen, everything works but what i try to do now is to call those screens randomly and this is working too but…

Florin Iftim
- 1
- 3
0
votes
0 answers
Reducing code repetition in a connecting flights scenario in Javascript
Without going too much in the details, my question is, how would you go about reducing the repetition in NodeJS? I am very much a beginner so please have mercy.
I am getting an api with the information, and output my own api which is that…

Henry
- 21
- 4
0
votes
1 answer
Smarter code that avoid repetition to control multiple players in one page
for a one-page portfolio, I have some repetition code for each button that control some video players populated by CMS.
I’ll have 15 to 20 players to control with each one is own button on the page to launch it , and return button to stop (1 on each…

sprea
- 19
- 4
0
votes
1 answer
how to get a list of non repeating substring from a string?
s="abcabcabc"
S=list(s)
li=[]
l=[]
for i in S:
if i not in l:
l.append(i)
else:
li.append(l)
l=[]
l.append(i)
print(li)
output is
[['a', 'b', 'c'], ['a', 'b', 'c']]
getting only two substring instead of…

Sidhant Pradhan
- 13
- 7
0
votes
2 answers
HTML href variable value
Update :
example of code at W3school tryit editor
In my webpage i have a feed of articles like 20, and under each one a Social Media Sharing Panel, to share each article, with code like this one :

Stalkium
- 148
- 1
- 11
0
votes
3 answers
Creating a list of non-repetitive elements from repetitive-elemets list. Using list-comprehansion only
How can I convert this "for-loop" below to "list-comprehension?
I want to create a list of non-repetitive elements from repetitive-elemets list.
many_colors = ['red', 'red', 'blue', 'black', 'blue']
colors = []
for c in many_colors:
if not c in…

Hermann Hesse
- 11
- 2
0
votes
1 answer
Calculating the index of an element in non-repetitive permutation
The following question is about math. The matter is, how to calculate the index of an element in a non-repetitive permutation. Example,
A={a,b,c} The permutation is then 3!=6 therefore: (a,b,c);(a,c,b);(b,a,c);(b,c,a);(c,a,b);(c,b,a)
I researched…

dude
- 117
- 6