On 2020-12-18, Joe Pfeiffer wrote:
> Grant Edwards writes:
>
>> Yep, there are definitly cases where it's pretty much the only right
>> answer. If you try to avoid it, you end up writing what turns into a
>> simulation of recursion -- and doing that correctly isn't easy.
>
> Decades ago I had to
Grant Edwards writes:
> On 2020-12-18, Joe Pfeiffer wrote:
>
>> Recursion has very limited application, but where it's the right
>> tool it's invaluable (top-down parsers, some graph algorithms...).
>> We teach it primarily because by the time a student has a good
>> handle on how to write a
On 2020-12-18, Joe Pfeiffer wrote:
> Recursion has very limited application, but where it's the right
> tool it's invaluable (top-down parsers, some graph algorithms...).
> We teach it primarily because by the time a student has a good
> handle on how to write a recursive function they
Bischoop writes:
> On 2020-12-17, Dennis Lee Bieber wrote:
>>>
>>
>> The main concern is that you are using a RECURSIVE call. It is much
>> better for such input checking to use an ITERATIVE (loop) scheme.
>>
>> def marriage():
>> #loop forever
>> while True:
On 2020-12-17, Bischoop wrote:
> On 2020-12-17, Dennis Lee Bieber wrote:
>>>
>>
>> The main concern is that you are using a RECURSIVE call. It is much
>> better for such input checking to use an ITERATIVE (loop) scheme.
>>
>> def marriage():
>> #loop forever
>>
On 2020-12-17, Dennis Lee Bieber wrote:
>>
>
> The main concern is that you are using a RECURSIVE call. It is much
> better for such input checking to use an ITERATIVE (loop) scheme.
>
> def marriage():
> #loop forever
> while True:
>
On 2020-12-17, Michał Jaworski wrote:
>
> Exactly. I would go even further and make it a reusable function. Eg.
>
> def prompt_choices(prompt, choices):
> choices = set(c.lower() for c in choices)
> while value := input(f"{prompt} {choices}:").lower() not in choices:
> pass
>
> I think he's hinting at using a loop instead.
>
> while maritals != 'Yes' and maritals != 'No':
>maritals = input('Married: Yes/No ?: ').title()
Exactly. I would go even further and make it a reusable function. Eg.
def prompt_choices(prompt, choices):
choices = set(c.lower() for c in
On 2020-12-17, Michael Torrie wrote:
> On 12/17/20 9:10 AM, Bischoop wrote:
>> Could you expand here, I rather don't know how I could do it different
>> way apart from if maritals == 'Yes' or maritals == 'No' or is it what
>> you meant?
>
> I think he's hinting at using a loop instead.
>
> while
On 12/17/20 9:10 AM, Bischoop wrote:
> Could you expand here, I rather don't know how I could do it different
> way apart from if maritals == 'Yes' or maritals == 'No' or is it what
> you meant?
I think he's hinting at using a loop instead.
while maritals != 'Yes' and maritals != 'No':
On 2020-12-17, Michał Jaworski wrote:
Thanks for feedback and useful tips.
I couldn't use any OOP here because have not a clue about it, just going
to go toward it.
> I've made a quick look at the code and even executed it. It looks pretty
> clear and is easy to understand, although it has
I've made a quick look at the code and even executed it. It looks pretty
clear and is easy to understand, although it has some structural problems.
I won't do a thorough review but highlight the most important problems.
First, the recursive user input pattern you use:
def marriage():
On 2020-12-17, Bischoop wrote:
Accidently removed the paste, https://bpa.st/E3FQ
--
https://mail.python.org/mailman/listinfo/python-list
I've done my biggest project that allowed me to learn a lot.
It's basically simply Database with basic options >> https://bpa.st/FU4A
.
What sucks here is basically the find_people() I'll have to work on it
yet to make it more useful.
.
If anyone was bored and wished to point me some wrong way
14 matches
Mail list logo