Skip to content
  • Tutorials
    • c programming
      • libraries
    • c++
    • Linux
    • Python
    • batch programming
    • Technology
  • IDE
  • Tools
python try else 1

python try else

June 16, 2022 by Anurag batra
try:
    a=2*3
except TypeError:
    print("Exception raised")
else:
    print("Everything is ok.")

Here is what the above code is Doing:
1. We are trying to multiply 2 and 3.
2. If there is a TypeError, we print “Exception raised”.
3. If there is no TypeError, we print “Everything is ok.”

Categories Python Examples
Post navigation
get text from txt file python
discord.py check if message has certain reaction
© MyEduKit - 2022 . All Rights Reserved.