Answer:
ch= str(input("Enter a character: "))
if str.isalpha(ch)==True:
  print("ASCII #%d" %ord(ch))
else:
  print("Not accepted")
Explanation:
Above, we check if the input is an alphabet, and only then ord is called or else Not accepted message is printed.