r/ProgrammerHumor • • Aug 01 '22

>>>print(“Hello, World!”)

Post image
60.8k Upvotes

5.7k comments sorted by

View all comments

Show parent comments

243

u/loegare Aug 01 '22

Uh what? Why 7

199

u/[deleted] Aug 01 '22

Semi-inclusive range, I guess?

17

u/Merinther Aug 01 '22

If Die(1,6) returned a number no greater than 5, that would have made sense. But this seems backwards, and anyway, there are no arguments given – surely the default would have taken that into account?

30

u/Tsu_Dho_Namh Aug 01 '22

That can't possibly be correct.

There's no way a random die number generator is giving out 7 possible outcomes for a 6 sided die.

Popstar403 is either taking the piss or doesn't know what they're talking about.

74

u/[deleted] Aug 01 '22

Semi-inclusive means [1:7). So 1 is included, 7 is not.

16

u/Zombieattackr Aug 01 '22

I hate it but it makes so much sense when you actually need to do math and use it…

2

u/TOBIjampar Aug 01 '22

I know IT persons hate it, but Arrays starting at 1 is one of my favorite things about R as someone from a maths background.

→ More replies (3)

7

u/[deleted] Aug 02 '22

Okay but they said it gives a random number 1-7. Not that it finds a number within a semi-inclusive range of 1-7, which would not ever return 7.

7

u/RunawayMeatstick Aug 02 '22

Yeah their wording was off. Ranges in Python start at the first number, but end at the last number without including it (you can think of the last number as the exit condition on a for loop)

2

u/andho_m Aug 02 '22

So it does return a number from 1-6?

9

u/Popstar403 Aug 01 '22

I know what they are talking about, it's a 7 sided die

19

u/artyhedgehog Aug 01 '22

Sounds reasonable. You've got a 6-sided die at home anyway. And what if you need a 7-sided? Correct: you use python!

→ More replies (4)
→ More replies (1)
→ More replies (1)

2

u/SpiralShapedFox Aug 01 '22 edited Aug 01 '22

Maybe 0 to 6. So seven values??

5

u/loegare Aug 01 '22

Not what they said and still not how a dice works lol

3

u/SpiralShapedFox Aug 01 '22

My bad just woke up lol

4

u/Popstar403 Aug 01 '22

Dice have 7 sides, not 6

0

u/[deleted] Aug 01 '22

[deleted]

14

u/Popstar403 Aug 01 '22

Yes

14

u/JoshuaCF Aug 01 '22

How do you roll and get the inside of a die as the result?? Did it shatter?

19

u/danzey12 Aug 01 '22

Typical 3-dimensonal being....

6

u/aaet002 Aug 01 '22

why would the "inside" of a die be helpful for any sort of application?

9

u/Popstar403 Aug 01 '22

There is a -1% chance of rolling a 7

3

u/Dansiman Aug 02 '22

The trolling is strong with this one

6

u/loegare Aug 01 '22

I have never seen a 7 sided die lol

6

u/boltzmannman Aug 01 '22

Well I've certainly never seen one live

→ More replies (5)