There was a 2015 problem where they linked a youtube video in a part2 in a way thst made it seem important but it was irrelevant and you only needed to change 40 to 50
also I don't think ruby room is doing Aoc. Java is my home (as you can see from my chat profile if you care enough to stalk) but I don't think they care either
I think the only thing that gives Java programmers an edge in a competitive environment over regular competitors is it's SO DAMN VERBOSE you can't realistically even write code outside an ide and supreme mastery of autofills like alt+enter, alt+space, keybinds and huge bars of sanity to spawn code like magic spells left and right and craft together what would be unearthly with determined, practiced moves without thinking
That java programmer would be DESTROYING the problem, while we are merely trying to solve
I don't code poorly when I need to not code poorly. When I'm in a competitive environment, I'm using the battlefield logic: Hope that what I need will arrive and give clear signal. For example, if I need to build a search that I might need to tweak, I won't pack it tightly into many lines.
If I need to find the function, it shouldn't be 1-char.
If I don't need to find it however, it's fair game. get in get out go back if we absolutely must
hmm, maybe it's just me, but copy-pasting comes with quite some penalty because there aren't many keyboard shortcuts to select text in my browser. I only do it when I'm in doubt
in every language I use, I make it really easy to pull up the regex engine :)
What is funny is that we all know that the timing is a huge driver of the "scoring" and that it is ridiculous. But what gets us (read me) upset is that I want to be at the top anyway (-: Just an innate desire to be at the top of the board
With most open contests online the problem is choosing a good start time due to so many time zones there are across the major tech hubs (US, india, ...). I think using midnight is a harsh but solid idea in that it removes a lot of people who aren't willing to stay up late so the playing field is narrower. Otherwise the board might be filled in ~30 seconds instead of ~3 min...
Yeah, because a regular sleep schedule takes 3 days to establish and we should force many productive people to become unproductive in order to compete in a festive event. :D
I didn't realise that Americans don't use "How's tricks?". Outside of the USA we get exposed to American English from an early age via TV, movies, and popular music, so we tend to be aware of the expressions Americans use that aren't in British or Commonwealth English, but it's not easy to notice the expressions that they don't use.
I just answered a question about global options affecting the formatting of floats. stackoverflow.com/questions/47628172/… I'm pretty sure such a thing doesn't exist. :) I wonder if it's ever been proposed?
TypeError: unhashable type: 'list' <<<< I get this error. I have a dictionary with keys and values, and I am trying to switch the keys and values in the lists.
no worries dude, but seriously your transformation is quite strange, there is no obvious logic behind it, its difficult to imagine in what scenario you would need to do something like that
Return a "last name to first names" dictionary based on the given "person to friends" dictionary. The returned dictionary should contain every person whose name appears in the given dictionary (as a key or in a value list). The keys in the returned dictionary should be the last names of people in the given dictionary.
(Remember: every person has exactly one last name.) The values are lists of the first names (in alphabetical order) of people with a given last name. Names in the list should be unique: no one should be listed more than once. Use the list method sort to put the lists of first names into alphabetical order.
personToFriends = {'Jay Pritchett': ['Claire Dunphy']}
names = set()
for person, friends in personToFriends:
names.add(person)
for name in friends:
names.add(name)
result = dict([name.rsplit(' ', 1)[::-1] for name in names])
Introduction
As is known, in 2017, Finland celebrates its 100 years of independence. To mark the occasion, it is your job to produce a Finnish flag for everyone's enjoyment.
Challenge
Create a program or a function that produces the flag of Finland (the grey border is there for presentation pu...
You can ask whatever you want, but you’ll likely not receive answers or even sympathy if you show that you don’t bother to try doing the work yourself.
the kind that demonstrates an eager effort to learn and to solve your problem on your own with some help, rather than wanting to suck the life out of everyone and making them do your work for you
@AndrasDeak would you say that is a good resource for beginners to programming in general?
I'm skimming through it and it seems like it requires somewhat of a previous knowledge in programming.
Nevermind, skimmed through more.
Anyway, thanks once again. I'll come back again another time. Sorry if I ruined anyone's mood, it really wasn't my intention. Hope you all have a blessed day.
def gen_constraints(self, variables):
"""
Generate a list of constraints based on the coordinate intersection of the provided variables
:param variables: List of variables to be evaluated for intersection
:return: List of constraints in the form of [((variable, position),(variable, position)), ... ]
"""
intersections = defaultdict(list)
for variable in variables:
for i, space in enumerate(variable.spaces):
intersections[space].append((variable, i))
@PM2Ring Basically, this is for solving a constraint satisfaction problem where I need to generate a list of where my variables intersect.
Personally, I'd probably just use a plain dict and the .setdefault method, since the default in your case is just a simple list. OTOH, using defaultdict is probably slightly more readable.
Here's a short example of using .setdefault:
d = {}
for i in range(12):
k = i % 4
d.setdefault(k, []).append(i)
print(d)
# output
{0: [0, 4, 8], 1: [1, 5, 9], 2: [2, 6, 10], 3: [3, 7, 11]}
Indeed, and that's why I rarely see the need for it. ;) OTOH, that .setdefault trick isn't so good for sets, since there isn't a simple empty set literal. Of course, you could define an empty list outside the loop, but if you're going to do that, you might as well just use defaultdict(set)