Post image
Light Mode
Dark Mode
Determine The Trajectory Of Frogs And Make Sure Your Code Doesn't Stink

Hello, checkiomates๐Ÿฑโ€๐Ÿ‘ค!

Let's find out if frogs will intersect and learn how to make your code less "stinky".

๐Ÿ’กTIP

On Easy difficulty, each of the few starting stations is dedicated to a distinct data type. If you want to discover all CheckiO features, visit our tutorial. It's a longread, but it's worth it!

๐ŸMISSION

Frogs Collision by freeman_lex -

In the vast expanse of an infinite two-dimensional grid, two adventurous frogs embark on their hopping journey. Each frog, characterized by a unique 4-tuple, sets forth with determination. Their positions at time t=0 and constant directional vectors propel them forward through discrete time steps. As they leap across the grid, the question arises: will their paths intertwine? The challenge beckons for a solution to determine the precise moment when both frogs, frog1 and frog2, synchronize their hops onto the same square. Should fate decree their paths never to converge, the function shall gracefully return None, leaving their trajectories to wander in parallel, never to intersect.

frogs_collision((0, 0, 0, 2), (0, 10, 0, 1)) == 10
frogs_collision((10, 10, -1, 0), (0, 1, 0, 1)) == None

๐Ÿ“–ARTICLE

Fix Python Code Smells with These Best Practices -

By finding and refactoring this stinky code, we can make our codebase more maintainable, readable, and scalable. This will make it easier for us to add new features, fix bugs, and collaborate with other developers.

๐Ÿ‘ฉโ€๐Ÿ’ปCODE SHOT

How do you think, what the following code does?

?????? = lambda num: len(__import__("re").search('0*$', str(num)).group(0))

๐Ÿ™Œ Thanks for your attention! Hope to meet you at CheckiO. We are really interested in your thoughts! Please, leave a comment below! โคต

Created: April 15, 2024, 4:40 p.m.
0
40
User avatar
freeman_lex