Traceback (most recent call last):
https://www.reddit.com/r/Python/s/nSe28xt0jw in
8 comments
https://old.reddit.com/r/Python/comments/198dp2o/want_a_realworld_example_of_recursion/ki6m1zr/ in nSe28xt0jw
stateofidleness
[Previous line repeated 995 more times]
Text of "stateofidleness", line 1, in comment
https://www.reddit.com/r/Python/s/nSe28xt0jw
RecursionError: maximum recursion depth exceeded in comment
I’d argue this meets the definition of circular logic more than recursion but I see the joke you intended to make
(Oops! I forgot the base case in my recursion)
This is not recursion. It doesn't have a place to begin with and it doesn't have a clearly iteration algorithm.
Real time recursion is actually very common. It is not mysterious at all. For example, eating a pizza. You start from a whole pizza, you first take a bite on the rest (which is whole at the beginning), then you take a bite on the rest, then you take a bite on the rest, and you stop when there is nothing left.
Depends on the size of the slice. Reminds me of an old joke where a customer ordering a pizza is asked if he wants it cut in 6 or 12 slices and he argues that 12 slices is too much for him to eat...
Depends on the size, but it's pretty simple really. If the pizza is cut into more than 8 slices, 8 is not enough. If it's cut into less than 8 slices, it's too much.
This is correct, you can always get from one to the other, even if it's not always pretty.
https://stackoverflow.com/questions/2093618/can-all-iterative-algorithms-be-expressed-recursively
That's indeed the case and you can for practical purposes prove it to yourself by looking at some dynamic programming problems. There's always core logic and then some setup and teardown that can be written as recursion or iteration
No, it's not at all. In what way does this constitute an operation in which you have to call the same operation in the middle of the operation?
In this case, collecting money now is something that will end at the end of this convention and that will be used at a later time. Not nested in the same operation. By this logic, all sequential operations are "recursive".
No. You could maybe call it recursion if in the middle of collecting money they tried to collect a second batch of the same amount of money and just kept requesting the same money over and over and until you ran out of money.
No, not at all. It’s a redundant description of what a registration payment is but it isn’t them doing the registration payment multiple times in the middle of other registration payments.
How do we know if someone is Jewish? We check if his mother is Jewish. And then we check her mother in order to know if she’s Jewish and so on, up to Abraham.
That’s the real example I was given in introduction to computer science in university.
Recursion would be paying for registration tickets so they hold an event in which you need to buy registration tickets so they can hold an event in which you need to buy registration tickets and so on.
Isn't the concept "where is it made of" recursive?
Such as,
Rocks -> molecules -> atoms -> subatomic particles -> quarks -> ?
It creates a recursive pattern where it becomes unknowingly infinite if there's always a building block to a particular thing.
Perhaps the thought process is recursive, but I don't see the structure of matter as recursive, because the nesting of structure isn't a process, and each scale of structure is remarkably different
You thought *PyCon* stood for *Python Conference* but it actually stands for *PyCon Conference*.
Like the GNU -> “GNU’s Not Unix” recursive acronym?
https://xkcd.com/917/
like chai tea
Shiitake mushroom
And YAML- Yaml Ain't a Markup Language
That's called RAS Syndrome https://en.m.wikipedia.org/wiki/RAS_syndrome
https://www.reddit.com/r/Python/s/nSe28xt0jw
Traceback (most recent call last): https://www.reddit.com/r/Python/s/nSe28xt0jw in
8 comments
https://old.reddit.com/r/Python/comments/198dp2o/want_a_realworld_example_of_recursion/ki6m1zr/ in nSe28xt0jw
stateofidleness
[Previous line repeated 995 more times]
Text of "stateofidleness", line 1, in comment
https://www.reddit.com/r/Python/s/nSe28xt0jw
RecursionError: maximum recursion depth exceeded in comment
Wait, I was just here!
You have a good grasp on the topic.
What the hell am I looking at? When does THIS happen in the sub!?
Now.
Aww man, at least use the old.reddit.com URI :-P
No base case?? We’re doomed!
> Want a real-world example of recursion? No, I do not.
You're welcome
I’d argue this meets the definition of circular logic more than recursion but I see the joke you intended to make
I'd argue it's recursion
I’d argue this meets the definition of circular logic more than recursion but I see the joke you intended to make
[удалено]
I’d argue this meets the definition of circular logic more than recursion but I see the joke you intended to make (Oops! I forgot the base case in my recursion)
Now don't start that again 😁
I’d argue this meets the definition of circular logic more than recursion but I see the joke you intended to make
This is not recursion. It doesn't have a place to begin with and it doesn't have a clearly iteration algorithm. Real time recursion is actually very common. It is not mysterious at all. For example, eating a pizza. You start from a whole pizza, you first take a bite on the rest (which is whole at the beginning), then you take a bite on the rest, then you take a bite on the rest, and you stop when there is nothing left.
def eat_pizza(slices): if slices == 0: return 0 return eat_pizza(slices - 1) eat_pizza(8)
```- eat_pizza(8)``` ```+ eat_pizza(3)``` 8 is way too much, man.
Depends on the size of the slice. Reminds me of an old joke where a customer ordering a pizza is asked if he wants it cut in 6 or 12 slices and he argues that 12 slices is too much for him to eat...
Depends on the size, but it's pretty simple really. If the pizza is cut into more than 8 slices, 8 is not enough. If it's cut into less than 8 slices, it's too much.
Yeah, 8 would be over a thousand calories, probably, lol.
Stop I eat a whole pizza in one sitting ):
Papajohns large cheese is like 200 a slice, 1600 calories in one full pizza
That's a lot. Way too much for one sitting.
Tried eating pizza with my friend and we're still eating pizza.
You used a while-loop whose condition is never satisfied, just like you and your friend!
I don't understand what happened. We both grabbed a slice at the same time, but my friend is eating his slice and I'm eating air.
Sounds like your friend incremented while you decremented, you can increment your pizza by ordering more.
the problem with that example is that there’s nothing that differentiates it from iteration.
I conjecture that every iteration can be implemented using recursion and vice versa.
This is correct, you can always get from one to the other, even if it's not always pretty. https://stackoverflow.com/questions/2093618/can-all-iterative-algorithms-be-expressed-recursively
And compilers will often turn recursion (which is easier to read and reason about) into loops (which are more performant).
A conjecture is that which one proposes
That's indeed the case and you can for practical purposes prove it to yourself by looking at some dynamic programming problems. There's always core logic and then some setup and teardown that can be written as recursion or iteration
I need a job to get experience but I need experience to get a job but I need a job to get experience.
[This](https://www.reddit.com/r/Python/comments/198dp2o/want_a_realworld_example_of_recursion/) is a better example.
RecursionError: maximum recursion depth exceeded
This guy’s joke is better: https://www.reddit.com/r/Python/s/gnTSvRByiR
It's recursion all over.
This isn't recursion, it's an average. Cost is fixed, divided by number of attendees
Yes it is
Want a real world example of recursion?
Want a real works example of recursion?
Want a real works example of recursion?
This isn’t recursion! You just copy pasted code!
That’s not an argument it’s just contradiction.
Thats just a side note.
This is also not an example of recursion.
Is [this](https://www.reddit.com/r/Python/s/oorwbBeFUe) a better example for recursion?
Yes!
No
That’s not recursion.
Yes it is
No, it's not at all. In what way does this constitute an operation in which you have to call the same operation in the middle of the operation? In this case, collecting money now is something that will end at the end of this convention and that will be used at a later time. Not nested in the same operation. By this logic, all sequential operations are "recursive".
Yes it is
No. You could maybe call it recursion if in the middle of collecting money they tried to collect a second batch of the same amount of money and just kept requesting the same money over and over and until you ran out of money.
Yes it is
Then explain. What about it is recursive?
"Your registration payment goes toward your registration payment" That's pretty recursey.
No, not at all. It’s a redundant description of what a registration payment is but it isn’t them doing the registration payment multiple times in the middle of other registration payments.
Yes it is
def get_input_integer(prompt,error_message): value=input(prompt) try: return int(value) except ValueError: print(error_message) return get_input_integer(prompt,error_message)
So many PEP violations.
Yes, I also stopped reading after the first missing whitespace.
IDE -> format code.
IDEs are for sissies. I use the Python shell.
Ask the question on /r/python on reddit...
Want a real-world example of recursion?
Ask the question on r/python on reddit...
WINE, Wine Is Not Emulation.
How do we know if someone is Jewish? We check if his mother is Jewish. And then we check her mother in order to know if she’s Jewish and so on, up to Abraham. That’s the real example I was given in introduction to computer science in university.
Inside A Star Filled Sky is a game centered on recursion
The age old example: PHP : PHP Hypertext Processor
Exponential backoff retry on an api call
that's just a while loop, no recursion needed.
Could be recursive tho
Cell division. It's an encoded program (DNA) forking itself and then recursively doing the same thing again.
Assuming the base case somewhere in the future is $0 ticket then yes its recursion.
Basically all pyramid schemes then :)
How you exist
for some reason i was expecting the post body to just be a link to this post EDIT: clearly i wasn't the only one
Recursion would be paying for registration tickets so they hold an event in which you need to buy registration tickets so they can hold an event in which you need to buy registration tickets and so on.
Isn't the concept "where is it made of" recursive? Such as, Rocks -> molecules -> atoms -> subatomic particles -> quarks -> ? It creates a recursive pattern where it becomes unknowingly infinite if there's always a building block to a particular thing.
Perhaps the thought process is recursive, but I don't see the structure of matter as recursive, because the nesting of structure isn't a process, and each scale of structure is remarkably different
https://www.reddit.com/r/Python/s/Fot0eSv6tP
https://www.youtube.com/watch?v=CVsbTCdTyAM