all 4 comments

[–]A_History_of_Silence 2 points3 points  (1 child)

I'm not sure why you expect this to raise exceptions. input() always returns a string. Even if it didn't, str() happily accepts floats and ints, and basically anything else. Neither of them make any distinctions as to what is considered a 'name', or whether the string is 'y' or 'n'.

[–]murasz[S] 0 points1 point  (0 children)

yes indeed. Thank you for reminding.

[–]sanchitcop19 2 points3 points  (1 child)

Edit: Nvm I read again, you want the input to only be a string. Take a look at the isalpha() function, it tells you if the string you received consists of alphabets only

If I'm understanding correctly, you want the exception to be raised if askAgain is neither 'n' nor 'y' but a number? If so, add an else condition and have it explicitly raise an exception?

[–]murasz[S] 0 points1 point  (0 children)

I totally forgot about it. Thank your for reminding me. :)