Question: I keep getting a syntax error on the else statement after my first if statement , how can i correct it . python programming .

I keep getting a syntax error on the else statement after my first if statement , how can i correct it . python programming . thanks

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)

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!