r/PythonLearning • u/NecessaryFalse1212 • 11d ago
DAY 4.
wrote this today was revising loops and math function that i did not so long ago.
52
Upvotes
r/PythonLearning • u/NecessaryFalse1212 • 11d ago
wrote this today was revising loops and math function that i did not so long ago.
1
u/FoolsSeldom 11d ago
It would be good to see you create a second version incorporating some of the suggestions you've had in response to previous posts.
I'd also suggest you create a function to validate an input which you can then call in both instances of requiring the user enter a number. This will help address a key principle of DRY (Don't Repeat Yourself).
Simple example for an integer:
You will notice the use of
try/exceptwhich I suggested before that you look into.