ProgrammerHumor

iEvenIsIntuative

iEvenIsIntuative
https://i.redd.it/onk8xxoa8ycf1.jpeg
Reddit

Discussion

secret_green_link

isEven(-8)

Uh? What do you mean that's not how it works?

1 day ago
Bonzie_57 OP
:ru::ts::py::ansible:

We just wait out for the overflow

1 day ago
sathdo
:j::g::c:

Python 3 ints don't overflow, they just allocate more ram.

1 day ago
Same-Letter6378

What happens if you run out of ram?

1 day ago
goldenfrogs17

then it's odd, or even, it depends on host system

1 day ago
Bubbles_the_bird

Schrödinger’s function

12 hours ago
kraskaskaCreature
:kt::lsp:

swap

1 day ago
tapita69

we autoscale machines with more ram and keep going!

1 day ago
AndreLinoge55
:sw:

just download more RAM

1 day ago
Disastrous-Event2353

Is there a python library to automate installing more ram? Or would that be too dangerous, since a script could just download all the ram in the world and everyone else would have none?

1 day ago
kampi1989

Kein Problem. Einfach auf den swap auslagern oder das Programm mit dem Hinweis pausieren das mehr RAM nachgerüstet werden muss. Wenn der swap ausgeht, wird einfach auf die Cloud umgestiegen.

1 day ago
NullOfSpace

It rents a cloud server and keeps going

19 hours ago
hollowman8904

Then you download more

16 hours ago
IAmASwarmOfBees

Also, python doesn't allow infinite recursion, it has a maximum depth.

23 hours ago
MathMaster85

Yes, but there's a recursion limit. I believe it's about 1000 by default.

10 hours ago
PrometheusAlexander
:py::js:

How bout abs?

1 day ago
secret_green_link

Still too much fat percentage for them to show I'm afraid :P

1 day ago
PrometheusAlexander
:py::js:

return IsEven(abs(-8)-2) would work

Edit: Tested and it does. Although can't fathom why not just return num % 2 == 0

22 hours ago
Qzy

Are you the intern at work, by any chance?

14 hours ago
PrometheusAlexander
:py::js:

Yeah no

9 hours ago
PinkSwayy

Technically correct. Also a speedrun to stack overflow

1 day ago
wyldcraft

Some languages will optimize the tail recursion, but not python.

1 day ago
theoht_

genuinely i sometimes forget that stack overflow is, like, a thing, and not just a website

1 day ago
Excellent-Refuse4883

IsEven(1000000000)

1 day ago
callyalater
:kt:

Inside the else block, you could nest another if/else statement to check if the number is less than 0 and if it is, return isEven(num+2), else return isEven(num-2).

1 day ago
Bonzie_57 OP
:ru::ts::py::ansible:

I only push code that will break with edge cases that aren’t even really edge cases

1 day ago
goldenfrogs17

I finally understand recursion.

1 day ago
Qzy

I finally understand recursion.

14 hours ago
doteroargentino
:cs:

I finally understand recursion.

12 hours ago
Bonzie_57 OP
:ru::ts::py::ansible:

🫡

1 day ago
FRleo_85
:py:

may i interest you in other ways to find if a number is even? https://github.com/desaleo/is-even

1 day ago
Bonzie_57 OP
:ru::ts::py::ansible:

This is awesome

1 day ago
FRleo_85
:py:

thank you 😅

1 day ago
Obvious_Tea_8244

Somebody must’ve screenshotted another PirateSoftware project.

1 day ago
PossibilityTasty

Did you just UperCamelCase a Python function?

1 day ago
Excellent-Refuse4883

1 day ago
Then-Hurry-5197

I created my own toy interpreted language and I didn't feel like adding the modulas operator at the time(And it obviously didn't have the bitwise operators) So I ended up using this exact method lol

20 hours ago
strikerdude10

Almost there. Just needs some memoization!

1 day ago
meggamatty64
:j::py:

Make sure you return math.abs(num-2) so it works with negative numbers

14 hours ago
x3n0m0rph3us

Old post.

1 day ago
Bonzie_57 OP
:ru::ts::py::ansible:

I just wrote this in my notes app, whatcha on man

1 day ago
x3n0m0rph3us

It is an old post because the "is even" algorithm keeps being posted to this sub every month or so.

19 hours ago
Bonzie_57 OP
:ru::ts::py::ansible:

19 hours ago
lgsscout

so are the "this is repost" responses, and you still did... where is your original response for the unoriginal post?

14 hours ago
Reasonable-Hair-187

Why are we going back to this?

1 day ago