Re: Review, suggestion etc?

2020-12-18 Thread Grant Edwards
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

Re: Review, suggestion etc?

2020-12-18 Thread Joe Pfeiffer
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

Re: Review, suggestion etc?

2020-12-17 Thread Grant Edwards
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

Re: Review, suggestion etc?

2020-12-17 Thread Joe Pfeiffer
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:

Re: Review, suggestion etc?

2020-12-17 Thread Bischoop
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 >>

Re: Review, suggestion etc?

2020-12-17 Thread Bischoop
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: >

Re: Review, suggestion etc?

2020-12-17 Thread Bischoop
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 >

Re: Review, suggestion etc?

2020-12-17 Thread Michał Jaworski
> 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

Re: Review, suggestion etc?

2020-12-17 Thread Bischoop
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

Re: Review, suggestion etc?

2020-12-17 Thread Michael Torrie
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':

Re: Review, suggestion etc?

2020-12-17 Thread Bischoop
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

Re: Review, suggestion etc?

2020-12-17 Thread Michał Jaworski
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():

Re: Review, suggestion etc?

2020-12-16 Thread Bischoop
On 2020-12-17, Bischoop wrote: Accidently removed the paste, https://bpa.st/E3FQ -- https://mail.python.org/mailman/listinfo/python-list

Review, suggestion etc?

2020-12-16 Thread Bischoop
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