Answers for "make an assertionerror in python"

-1

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."
Posted by: Guest on September-02-2020

Code answers related to "make an assertionerror in python"

Python Answers by Framework

Browse Popular Code Answers by Language