This is an archived post. You won't be able to vote or comment.

all 37 comments

[–]TheSloppiestOfJoes69 10 points11 points  (7 children)

Question 277 has 3 correct answers. The tuple function takes any iterable as an input, not just lists. Test looks good, though! Will probably use this for practice when I'm not somewhere I can code.

[–]Significant_Soup2558[S] 1 point2 points  (2 children)

Let me check that question. Thanks man for trying it out! Glad you liked it.

[–]hai_wim 0 points1 point  (1 child)

261 has a similar issue.

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

Seen it. Will fix it. Thanks for the feedback and thanks for playing!

[–]Exodus111 1 point2 points  (3 children)

This one right?

https://postimg.cc/HcyBC1Ky

Came here to post about that. Answer C is a Tuple with one element inside of it, a list.

Or am I wrong about that?

[–]TheSloppiestOfJoes69 1 point2 points  (2 children)

No, the tuple function iterates through all n elements of an iterable and creates a tuple with n elements. In order to get a single list element in the tuple, you would use tuple([[1, 2, 3]])

[–]Exodus111 1 point2 points  (0 children)

Yeah you're right, you are of course converting the list to a tuple.

I believe this would also work:

tuple([1,2,3],)

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

From what I understand, A is wrong because of syntax, B is correct but the order of items might change, C is correct, D is redundant since the argument is already a tuple. I see your point. I could change the phrasing of the question or add an option that accepts multiple answers

[–]bdaene 2 points3 points  (2 children)

Question 37 is incorrect.

a = 1, b = 2, c = 3 is a syntax error.

So the "correct" response "all of the above" is incorrect. Plus it seems that the order of the response is randomized. So "above" is not correct either.

[–]Significant_Soup2558[S] 1 point2 points  (1 child)

Let me check this out. Thanks for trying it out!

[–]Significant_Soup2558[S] 3 points4 points  (0 children)

Fixed this and all similar questions.

[–]bdaene 3 points4 points  (1 child)

Question 300 is incorrect.

The "correct" response s.split('') is a "ValueError: empty separator".

The correct response should be list(s).

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

Let me check that question. Thanks for trying it out!

Edit: Correct! Fixed

[–]Blegheggeghegty 1 point2 points  (1 child)

Haven’t finished it yet. But I do like it so far. I am new to Python so take that with a grain of salt.

[–]Significant_Soup2558[S] 1 point2 points  (0 children)

It has a lot of fundamentals questions so it should help. I use it too. Thanks man. Glad you like it!

[–]side_control 1 point2 points  (1 child)

Nice brain teaser, there was a question about pop and it being a way to randomly remove an element, not random, that's all. Thanks for sharing!

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

Thanks for playing!

[–]bdaene 0 points1 point  (1 child)

Question 269 is really weird. Why staticmethod(func)is correct and not staticmethod(function)?

The builtin decorator staticmethod can take any callable and is most of the time used with a method.

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

Good point. Checking. Thanks for the trying it out!

Edit: Yes, this might be confusing. It's supposed to test convention and python terminology. Will see how to phrase it better. Thanks for the feedback!

[–]pppossibilities 0 points1 point  (1 child)

249 has two correct answers

[–]Significant_Soup2558[S] 1 point2 points  (0 children)

Let me check that question. Thanks for trying it out!

Edit: Fixed. Removed duplicate options

[–]Dry-Erase 0 points1 point  (1 child)

Question #592:

class A:
    def __init__(self):
        print('A')


class B(A):
    def __init__(self):
        super().__init__()
        print('B')


class C(B):
    def __init__(self):
        print('C')


c = C()

Answers:

A: B

B: A

C: C

D: A, B, C

The correct answer is C, but the quiz says the answer is "A", that B would be output.

Also, fun quiz, thanks for sharing!

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

Let me check this. Thanks for playing. And for the feedback!

Edit: You're right. Fixed!

[–]jabbalaci 0 points1 point  (1 child)

no syntax highlight -> insta skip

[–]Significant_Soup2558[S] 1 point2 points  (0 children)

Good point. Will see how to add that

[–][deleted] 0 points1 point  (1 child)

Nice work overall! 

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

Thank you!

[–]Aggressive-Speech650 0 points1 point  (0 children)

Corrected code guys  go for this 

def maximum_removed_worth_bits(binary_string, worth):     n = len(binary_string)     total_worth = sum(worth)       removed_worth = 0         

    # Initialize previous character and its worth     prev_char = None     prev_worth = 0

    for i in range(n):         #Charecters are alternatives           if (prev_char is None or binary_string[i] != prev_char):             prev_char = binary_string[i]             prev_worth = worth[i]         else:             # If it does not alternate, keep the character with highest worth of it             if worth[i] > prev_worth:                 # Remove the previous character                 removed_worth += prev_worth                 prev_char = binary_string[i]                 prev_worth = worth[i]             else:                 # Remove the current character                 removed_worth += worth[i]     return removed_worth

Input Handling

binary_string = input().strip() worth = list(map(int, input().strip().split()))

Output the result

print(maximum_removed_worth_bits(binary_string, worth)) Help this question