make an assertionerror in python

Solutions on MaxInterview for make an assertionerror in python by the best coders in the world

showing results for - "make an assertionerror in python"
Maximiliano
05 Sep 2017
1# ask for a name
2answer = input("Please enter your name:")
3
4# make sure it consists of only alphabetical characters (a-z/A-Z)
5# assert <condition: bool>, <Error message: str>
6assert all([1 if char.isalpha() else 0 for char in answer]) == True, "Please make sure your name consist of only alphabetical characters."