Python Program To Test String Starts With A Capital Letter
01. Example
Using isupper() function with For loop.
- Initialize String.
- Set a flag value False.
- Check with isupper() function for first element of string.
- If first element is capital then change flag value False to True.
- Print output.
string ="Zeroones python programs." print("The input string : " + str(string)) flag = False for element in string.split(): if element[0].isupper(): flag = True # printing result print("Paragraph First Letter Is Capital: " + str(flag))
Output:
The input string : Zeroones python programs. Paragraph First Letter Is Capital: True