python从键盘输入一个英文句子,如果首字符小写改为大写如果句末没有标点符号加上.最后输出
a = input().strip()
a = a[0].upper() + a[1:]
a += '.' if a[-1] != '.' else ''
print(a)
sentence = input('请输入一个英文句子: ').strip() #this is my family
sentence = sentence.capitalize()
sentence += '.' if sentence[-1] != '.' else ''
print('处理后的句子为:',sentence)
不知道你这个问题是否已经解决, 如果还没有解决的话: