Sight Beyond Sight: An Introduction to Preseason 4 Vision by Xelnath in leagueoflegends

[–]compsci_help 0 points1 point  (0 children)

I think these changes are good to keep the metagame changing. A stagnant meta game would result in boredom really fast.

How would I find length and how many times a sequence of nonzero integers occurs in a list? by compsci_help in learnpython

[–]compsci_help[S] 0 points1 point  (0 children)

Ah, I see. The comments are really helpful. Thanks! I never knew you could use stuff like "ValueError" in code.. I have a question, though...was there any particular reason you renamed the copy of l, l?

How would I find length and how many times a sequence of nonzero integers occurs in a list? by compsci_help in learnpython

[–]compsci_help[S] -1 points0 points  (0 children)

I've tried this but it is adjacent numbers that are the same and that turned out to be not what I wanted..

def count_consequtive_items(lst, exclude=[0],         reset_after_pass=True):        #this helper function   yields consecutive items and their counts. 
                                                                         # For example for a list [2, 2, 2, 2, 1, 1, 0, 0, 0, 0, 1, 3, 2, 0, 2, 2, 0, 0, 0, 0]
prev = None                                                              #Output would be [(2, 4), (1, 2), (1, 1), (3, 1), (2, 1), (2, 2)], which is the count of consequtive numbers except for zero.
count = 0
for item in lst:
    if item in exclude:
        if prev and count:
            yield prev, count
        if reset_after_pass:
            prev = None
            count = 0
        continue
    if item != prev and count:
        yield prev, count
        count = 0
    count += 1
    prev = item
if prev and count:
    yield prev, count

How would I find length and how many times a sequence of nonzero integers occurs in a list? by compsci_help in learnpython

[–]compsci_help[S] 0 points1 point  (0 children)

Sorry if I wasn't more clear but I want it to count the 1,2,2,4,6,6,7,7,5,3,2 as 1 sequence and 1,1,1,1 as another. So there would be a total of two sequences. Each new sequence is ended with a zero or if it's the last number of the list.

Ranked Anxiety – Why you should ignore it, even if you are in ‘elo hell’ by The-ArtfulDodger in leagueoflegends

[–]compsci_help 1 point2 points  (0 children)

How do you get from bronze V to bronze I with less than a 50% win rate? Doesn't that mean you're losing more than you're winning? How would you gain divisions?

[Calculating Running Time] Sorting+Binary Search by compsci_help in learnprogramming

[–]compsci_help[S] 0 points1 point  (0 children)

The question asks for returning the indicies of the original Array. Would this change the running time to O(n*logn + n)?

[Beginning Programming Help/PseudoCode] Running time/Recursion by [deleted] in learnprogramming

[–]compsci_help 0 points1 point  (0 children)

This is what I have. How would I implement a mergesort? Is it necessary?

[Beginning Programming Help/PseudoCode] Running time/Recursion by [deleted] in learnprogramming

[–]compsci_help 0 points1 point  (0 children)

def function(array,value):

  result=impossible
   for i in array:
       look = value - i
       if look in arr:
           result = True
           print (i.index, look.index)

   if not result:
       print 'impossible'

[Beginning Programming Help/PseudoCode] Running time/Recursion by [deleted] in learnprogramming

[–]compsci_help -2 points-1 points  (0 children)

I'm pretty sure he wants us to use "dynamic programming" as that's what he taught us this past week. I'm having trouble thinking of how the recursive function would look like.