this post was submitted on 19 Feb 2024
15 points (100.0% liked)

Programmer Humor

19519 readers
319 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
top 14 comments
sorted by: hot top controversial new old
[–] joyjoy@lemm.ee 2 points 8 months ago (1 children)

You call that russian roulette? This is real russian roulette. Dying is a 1/6 probability.

#!/usr/bin/env python3
import random

barrel = [0, 0, 0, 0, 0, 1]
random.shuffle(barrel)

print("Russian Roulette")
for i in barrel:
  input("Press enter to shoot")
  if i == 1:
    print("You are dead.")
    exit()
  else:
    print("Phew. You survived.")
[–] librecat@lemmy.basedcount.com 0 points 8 months ago (1 children)

I love this, except for i i hate i.

[–] faintwhenfree@lemmus.org 1 points 8 months ago

I like it, i for int easy to remember. I also use i, j, k as u it vectors and remember at what depth of a multidimentional array in working at.

[–] philomory@lemm.ee 1 points 8 months ago (1 children)

Wow, a Lain meme was not something I was expecting.

I should watch that show again sometime, I still have the DVDs somewhere I think.

[–] xmunk@sh.itjust.works 1 points 8 months ago (1 children)

"And you don't seem to understand..."

[–] Tesla@lemmy.world 1 points 8 months ago

A shame you seemed an honest man...

[–] random9@lemmy.world 1 points 8 months ago

isn't randint range inclusive? thus random.randint(0, 6) == 1 has a 1 in 7 chance, not 1 in 6. Most revolvers, assuming this is emulating russian roulette, have 6 cylinders, not 7.

[–] Asudox@lemmy.world 1 points 8 months ago

Let's all love lain.

[–] GluWu@lemm.ee 1 points 8 months ago

Fuck off, I know what I'm doing.

Omg someone please help how did I get this far they're going to realize I'm stupid when they fire me everything will collapse because it's all in a single excel file I need to figure out how to live in a tent in the woods and hunt and forage

[–] mox@lemmy.sdf.org 1 points 8 months ago (1 children)

Perfectly safe on Windows, too. The remove() function doesn't work on directories.

[–] aodhsishaj@lemmy.world 1 points 8 months ago (1 children)

Remove-Item -LiteralPath "C:" -Force -Recurse

[–] okamiueru@lemmy.world 0 points 8 months ago (1 children)

I'm curious. Does anyone like PowerShell, and the syntax you end up with?

[–] egonallanon@lemm.ee 1 points 8 months ago

Yeah I'm a big fan of it. People complain about the verbosity of it but I like that for readability and autocomplete makes that a non issue I find. Plus if you really want to save on typing when using it as a terminal tool you can just make aliases for all your common commands.

[–] csm10495@sh.itjust.works 1 points 8 months ago

That can't remove a directory.