我似乎无法摆脱功能并且来回传递内容我将包含说明和代码。有人能告诉我我哪里出错了吗?字符串操作
说明: 编写一个程序与接受字符串作为参数,并返回字符串的副本,每个句子的第一个字母大写的功能。
例如: 用户输入"my name is Earl. my favorite college is Mott Community College."
程序都将返回"My name is Earl. My favorite college is Mott Community College."
def main():
strAccepted = input('Enter introduction sentence (Example: my name is..): ')
strAccepted2 = input('Enter your school (Example: my school is..): ')
print('You entered: ', first(fixed))
print(second(fixed2))
def first():
for character in string:
character = strAccepted[0]
fixed = upper(character)
return fixed
def second():
for character2 in string:
character2 = strAccepted2[0]
fixed2 = upper(character2)
return fixed2
main()
请再具体些,什么是你的代码错误尝试的输出。为了这项任务的目的,一个句子的定义是什么?这是一串字符后面跟着一段时间吗? –
请在'for loops'处更正您的缩进。并发布你得到的错误消息。 –
是@RoryDaulton后跟一个句点的字符串。 –