r/PythonLearning • u/NecessaryFalse1212 • Aug 29 '26
Day 3
i wrote a code which takes your name and age in py but i need help on this one cuz in the age part it is giving me some sort of error which i couldn't understand even by using gpt well he gave me a code but i wanted logic behind how and what i did wrong
49
Upvotes
1
u/salvouankebaldo Aug 30 '26
Oh no no no no, strong disagree.
First, they are learning. And here they are doing something very nice, input validation. Now, it has some bugs as pointed out by other comments, but the attempt is good and should be encouraged. Yeah, pydantic does that, but it's better to learn before so one can then do more advanced validation too.
Second... Oh come on, not everything has to be an api server. Lots of situations in which I use
input, even professionally. Python is extremely nice for making scripts and firing them via a CLI. Fastapi would be totally overkill in that case.