Question: why is my code requiring that the first word has to be all capitalized . i just want it to check that the first letter

 why is my code requiring that the first word has to

why is my code requiring that the first word has to be all capitalized . i just want it to check that the first letter is capitalized . also the corrected sentece that it produces has no spaces how can i get it to space out the words. PYTHON

sent=input("enter a sentence :")

sentList=sent.split()

first=sentList[0]

capt=0

punct=0

sent1=""

if(first.isupper()== True): sent1=''.join(sentList) else: capt=1 sentList[0]=first.upper() sent1=''.join(sentList) if (sent1.endswith(('!','.','?',':','#'))): pass

else: sent1 +="." punct=1 if(capt==1 and punct ==0): print("Invalid , first word not capitalized , please correct:") print(sent1) elif(capt==0 and punct == 1): print("Invalid , sentence did not end with punctuation, please correct:") print(sent1) elif(capt==0 and punct ==0): print("sentence correct:") elif(capt==1 and punct==1): print("invalid sentence not capitalized and no punction please correct") print(sent1)

Problem

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!