The document describes a preWord() function that takes a string as a parameter and checks if it is a single word starting with "pre" and containing only alphabetic characters. It returns True if the checks pass or False if they fail. The document also provides instructions to test the function by getting user input, calling preWord() on it, and printing a message explaining if it is or is not a valid pre word.
Write the code for preWord() function. The function has a single str.pdf
1. Write the code for preWord() function. The function has a single string parameter that it checks
for a single word starting with pre.
Check if word starts with pre
Check if word .isalpha()
If all checks pass: return True
If any checks fail: return False
Test:
Get input using the directions enter a word that stars with pre :
Call preWord() with the input string
Test if return value is False and print message explaining not a pre word
Else print message explaining is a valid pre word
Write the code for preWord() function. The function has a single string parameter that it checks
for a single word starting with pre.
Check if word starts with pre
Check if word .isalpha()
If all checks pass: return True
If any checks fail: return False
Test:
Get input using the directions enter a word that stars with pre :
Call preWord() with the input string
Test if return value is False and print message explaining not a pre word
Else print message explaining is a valid pre word