CYBER WEEK - EXTRA SAVINGS EVENT
TRY A FREE LESSON

Project: Mobile App for Lottery Addiction

Hello colleagues,
In this link you can find my attempt to tackle this guided project, I have used interactive functions using the input method, the try/except bloc and a while loop.

Project: Mobile App for Lottery Addiction

2 Likes

Hi

Great job on this project.

I really like that you made the functions interactive.

One thing that you might be interested in checking for the future is to introduce assert statement.

An assert statement can help you to enforce a precondition in just one line of code.

For example, if you want the user to input a number n between 2 and 5, you could write:

assert n in [2,3,4,5], “Number out of range.”

If n in [2,3,4,5] is true, then the code will continue to run; if it is False, the error message " Number out of range" will display.

You can read more about assert statements on this [link][ https://www.programiz.com/python-programming/assert-statement].

Other than that, you have done a great job on the interactive functions.

Regards

Juan

1 Like

Thank you @juanjosemunozp for your comments.
yes you are right, applying assert would be more efficient. I will take this into consideration if I ever come across a similar situation.
Thanks again.