Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 91213

This challenge is related to the Python language. Note that challenges that require the answers to be in a specific language are generally discouraged.

1 vote

Speed up, slowpoke!

Split the difference def split_the_difference(info, me, round): my_info = next(i for i in info if i[0]==me) if my_info[2]<10: return [me, 1, 1] info.sort(key=lambda i: i[2]) …
mousetail 'he-him''s user avatar
3 votes

Speed up, slowpoke!

Impersonator Not sure if this loophole is allowed. Since many bots help those with similar names this impersonates the top bot by name. import traceback def impersonator(info, me, round): def eq( …
mousetail 'he-him''s user avatar
1 vote

Speed up, slowpoke!

Advanced Impersonator import random def advanced_impersonator(info, me, round): info.sort(key=lambda i:i[1]) # pick a bot in the top 25% bot = random.choice(info[len(info)*3//4:]) …
mousetail 'he-him''s user avatar
1 vote

Speed up, slowpoke!

Karma import random, string def karma(info, me, round): my_info = next(i for i in info if i[0]==me) if my_info[2]<40 or round < 500: return [me, 1, 1] # Some bots where explicitl …
mousetail 'he-him''s user avatar
1 vote

The Dating Game / Secretary Problem

Anything but the worst class AnythingButTheWorst: """ Will accept anyone as long as there is someone worse """ # rng is a seeded PRNG you can use, no other forms of randomness allowed …
mousetail 'he-him''s user avatar
2 votes

Tips for golfing in Python

You can use this for side effects, for example consider this python quine: c:print(c%c)="c:print(c%%c)=%s" In this case, this is the exact same length as c="c:print(c%%c)=%s" print(c%%c) However, in …
mousetail 'he-him''s user avatar
18 votes
19 answers
6k views

The Dating Game / Secretary Problem

The bots are looking for love. Can you help them? The rules The goal of this game is find the bot you have the highest compatibility with. However, robots, who are inexperienced at dating are unable t …
mousetail 'he-him''s user avatar
4 votes

Is this series of quotes valid Python?

Regex (Javascript/PCRE), 31 28 bytes -3 bytes thanks to Neil and Mukundan314 ^(""$|"a+"|"""("?"?a)*""")+$ Try it on regexr Basically: Empty single-quoted string may appear only at the end A single …
mousetail 'he-him''s user avatar
4 votes
Accepted

Shortening this Code to process nested tuple even further without the use of max()

Python, 204 188 bytes -16 bytes thanks to @WheatWizard m=[*((input("Enter subject: "),int(input("Enter marks: ")))for _ in'*'*int(input("Enter number of tuples: ")))] print((*((i[:3].upper(),j)for i,j … Python, 212 bytes 1 line print((*[m:=[*((input("Enter subject: "),int(input("Enter marks: ")))for _ in range(int(input("Enter number of tuples: "))))]][:0],*((i[0][:3].upper(),i[1])for i in m if all(z[ …
mousetail 'he-him''s user avatar
26 votes
14 answers
3k views

Is this series of quotes valid Python?

Python string parsing has quite a few edge cases. … b, u, r, and f would work exactly the same, you don't need to concern yourself with that detail), determine if it would be a valid python string, or invalid syntax. …
mousetail 'he-him''s user avatar