How to check if each word in a string begins with capital letter in Python?


How to check if each word in a string begins with capital letter in Python?

1 Answer

4 years ago by

//python
o=input()
l=[str(x) for x in o.split(" ")]
c=0;
for x in l:
if(ord(x[0])>=65 and ord(x[0])<=90):
c=c+1;
else:
break;
if(c==len(l)):
print("Yes")
else:
print("no")

3 years ago by MaheshReddy Jammula