[Tutor] Validating specific integer input [Was: Re: Converting a txt file to dictionary]
boB Stepp
robertvstepp at gmail.com
Sat Aug 29 12:21:53 EDT 2020
On Sat, Aug 29, 2020 at 11:04 AM boB Stepp <robertvstepp at gmail.com> wrote:
> On Sat, Aug 29, 2020 at 2:38 AM nzbz xx <nzbzxx at gmail.com> wrote:
> > while data_validation(User_Decision):
> > User_Decision = input(">")
>
> We have reached the end of the code you provided. Have you run this
> code? What happened? Is it what you expected?
>
> Notice that you have never called your validation function, so it is
> doing nothing for you. Where would the logical place to call it and
> validate user input?
Ugh. I fell asleep at the switch here! You *do* call your validation
function, but as you never explicitly return anything from that
function it is not doing what you expect. Note that if you do not
return anything from a function explicitly it returns "None".
--
boB
More information about the Tutor
mailing list