Difficulty with raise block output in py | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Difficulty with raise block output in py

I tryed one code for raise block of python where i supposed to get output as >TypeError But it will showing >It's own error type then Type error Anyome explain why

18th Jul 2019, 2:57 AM
Rushikesh Dakhore
3 Answers
+ 2
Rushikesh Dakhore That link worked, I think the issue was that everything was converted to lowercase in the tag, and the code URLs are case sensitive. Next time I'd suggest putting it in the question body rather than in the tags.
18th Jul 2019, 3:26 AM
JS Coder
+ 2
The link to your code in the tag did not work, but I found the code that (I think) you were trying to reference. From that code, the first TypeError is because you were trying to add 5 (an integer) and 'rushi' (a string). These types are not compatible for addition in python, so a TypeError is thrown. Once this error is fixed, your "raise TypeError" line will be reached and executed, returning the error you expected. Note that the error message will point to the line with the raise statement, but this is just how raise works, there is not an error in your raise statement.
18th Jul 2019, 3:07 AM
JS Coder
0
Thank you for your answer JS Coder i am writing post for the first time may be that's why it don't khow how to attach code https://code.sololearn.com/cStY21ZpN2nd/?ref=app
18th Jul 2019, 3:20 AM
Rushikesh Dakhore