Skip to main content
Advice
0 votes
4 replies
57 views

I was solving the algorithm problem: find all unique substrings from the string, using sets. Here is the model solution, but I can't understand what line 6 means. Why does the end go up to length + 1? ...
Ilona's user avatar
  • 21
1 vote
0 answers
34 views

I have 3 sets: alice = {'first_kill', 'level_10', 'treasure_hunter', 'speed_demon'} bob = {'first_kill', 'level_10', 'boss_slayer', 'collector'} charlie = {'level_10', 'treasure_hunter', 'boss_slayer',...
0xYNS's user avatar
  • 43
Best practices
0 votes
6 replies
29 views

What functional or mixed functional programming languages support nested sets, akin to the usage in mathematics and set theory? Specifically those with a REPL? I tried Python and couldn't get nested ...
notaorb's user avatar
  • 2,240
Advice
0 votes
5 replies
92 views

I have some data fields gathered in a SET statement like this: set "datastr=%num_cde%, %id_achat%, %modele%, %sysfam%, %serial%, %ldt%" later assigned to an email body as: SET "...
calade's user avatar
  • 35
1 vote
1 answer
113 views

In Postgres, you can set current_user by: set session_authorization = 'new_user'; and set role 'new_user'; While I like the shorter syntax, I'm asking if there is a difference in functionality ...
Code4R7's user avatar
  • 3,216
0 votes
4 answers
183 views

How can I create objects from a Set? const dupObj = [{ id: 1, value: 'a' }, { id: 2, value: 'b' }, { id: 1, value: 'c' }]; const uniKeys = [...(new Set(dupObj.map(({ id }) => id)))]; // [ '1', '2' ]...
Run's user avatar
  • 57.7k
3 votes
2 answers
286 views

According to the Python documentation, set is a mutable unordered collection. Usually, it's implemented as a hash table that stores references to objects as its keys. Comparing to dict (which is also ...
SLebedev777's user avatar
8 votes
3 answers
1k views

I am trying to solve the problem posed in this question. Here the OP asks that given a 15 element set, its 2^15 element power set be generated in a manner such that the elements of the power set are ...
uran42's user avatar
  • 685
4 votes
2 answers
185 views

Let's say I have a box and there is a bunch of balls in that box. I can label each ball with a character while making sure no two balls get the same character as labels. I get a string this way. Let's ...
uran42's user avatar
  • 685
0 votes
3 answers
103 views

I'm learning Python coming from some beginner-level experience with Java. It all makes sense for the most part, but one of the exercises kind of made me wonder what actually happens within Python. ...
Lucas Durrant's user avatar
0 votes
2 answers
67 views

I'm working with the GAMSPy Python API and using Set objects to define sets in a GAMS model. I can define a set like this: from gamspy import Container, Set m = Container() regions = Set(m, name=&...
user30451554's user avatar
2 votes
3 answers
211 views

I want to write a computer programme that will do the following things : 1a. It will make an array 3 characters long. £££ 2a. It will then initialize the array with the string "{_}" and ...
uran42's user avatar
  • 685
1 vote
2 answers
76 views

Why the following code caused dead loop? const s = new Set([1]); s.forEach(e => { s.delete(e) s.add(e) }) I tried to change the order about delete and add operation,the dead loop ...
Turbo Zhang's user avatar
0 votes
2 answers
111 views

to clarify, it would be used like any(set()). I am asking for efficiency sake. Example: if any(fnmatch(a,b) for a in set) where a would be an item in a set and b would be a string.
arnoldpalmer's user avatar
5 votes
3 answers
293 views

Say I have a dictionary of sets like this: d = {'a': {1,2,8}, 'b': {3,1,2,6}, 'c': {0,4,1,2}, 'd': {9}, 'e': {2,5}, 'f': {4,8}, 'g': {0,9}, 'h': {7,2,3}, 'i': {5,6,3}, 'j': {4,6,8}} Each set ...
Shaun Han's user avatar
  • 2,975

15 30 50 per page
1
2 3 4 5
809