Question: USING PYTHON ROGRAMMING AND WHILE LOOPS, DO NOT USE BREAK,PASS AND CONTINUE, FOR LOOPS Create a program tha t che cks the grammar of a
USING PYTHON ROGRAMMING AND WHILE LOOPS, DO NOT USE BREAK,PASS AND CONTINUE, FOR LOOPS
Create a program tha
t
che
cks the grammar of a sentence: i
t must start with a
capital letter, and it must end with
?
,
!
, or
.
(a question mark, exclamation
mark, or period).
The program must use two functions for this:
checkCapital()
and
checkPunctuation()
, both of which take
in the complete sentence as their
only
formal parameter.
Each function must print out whether the sentence
passes or fails their requirement.
Within
main()
, the user can continue entering sentences to check until they
want to quit, which they do by ente
ring an empty string (hitting Enter without
typing anything).
SAMPLE OUTPUT
bash
-
4.1$ python hw5_part3.py
Enter a sentence (enter noth
ing to quit):
dogs are good
WRONG
-
Sentences start with a capital letter.
WRONG
-
Sentences use punctuation.
Enter a sentence (enter nothing to quit):
dogs are good.
WRONG
-
Sentences start with a capital letter.
Correct punctuation!
Enter a sentence (ent
er nothing to quit):
Dogs are good
Correct capitalization!
WRONG
-
Sentences use punctuation.
Enter a sentence (enter nothing to quit):
Dogs are good!
Correct capitalization!
Correct punctuation!
Enter a sentence (enter nothing to quit):
Dogs are good?
Co
rrect capitalization!
Correct punctuation!
Enter a sentence (enter nothing to quit):
I!
Correct capitalization!
Correct punctuation!
Enter a sentence (enter nothing to quit):
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
