using python assertion code example

Example 1: assert syntax python

assert <condition>,<error message>
#The assert condition must always be True, else it will stop execution and return the error message in the second argument
assert 1==2 , "Not True" #returns 'Not True' as Assertion Error.

Example 2: make an assertionerror in python

# ask for a name
answer = input("Please enter your name:")

# make sure it consists of only alphabetical characters (a-z/A-Z)
# assert <condition: bool>, <Error message: str>
assert all([1 if char.isalpha() else 0 for char in answer]) == True, "Please make sure your name consist of only alphabetical characters."