Functions · 12 / 27 Exercise Medium

Check alphabetical string

Objective

Create a Python program that defines the function is_alphabetic() to check whether a text entered by the user contains only alphabetic characters (a-Z), uppercase or lowercase.

Instructions

  • The program asks the user for a text.
  • The function is_alphabetic() checks that the text only contains letters (a-Z).
  • If it does, the message The text contains alphabetic characters. is displayed. Otherwise, The text does not contain alphabetic characters. is displayed.
Input
Hello
Output
The text contains alphabetic characters.

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise