How to add alerts in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

How to add alerts in python?

How can we add alerts linke in JS alert() so that the user of the code can know that what he has to input.

14th Apr 2019, 4:34 AM
Usama Navid
Usama Navid - avatar
5 Answers
+ 2
You can do that with exception handling https://code.sololearn.com/cS23229f7GOe/?ref=app
14th Apr 2019, 5:06 AM
Yugabdh
Yugabdh - avatar
+ 7
What do you think about this one? There is an alert box here... I have never seen the better alerts for python!!! https://code.sololearn.com/cey1rm5X9PYC/?ref=app https://code.sololearn.com/cNsKyh6qJxv0/?ref=app
8th Mar 2021, 5:16 PM
PASHA 🇷🇺
PASHA  🇷🇺 - avatar
+ 3
thanks for your time
14th Apr 2019, 5:11 AM
Usama Navid
Usama Navid - avatar
+ 2
You can't do that. It's better to add nice little comment for user in your code or provide helpful string in input() which will make user comfortable with inputs.
14th Apr 2019, 4:40 AM
Yugabdh
Yugabdh - avatar
+ 2
Can I add error message then, if the input is wrong. For example in the following code I want to put an error message if the input is not between 1 and 6. https://code.sololearn.com/c86UK9B1STi4/?ref=app
14th Apr 2019, 4:44 AM
Usama Navid
Usama Navid - avatar