gpt4 book ai didi

python - python编码的单词分隔符

转载 作者:太空宇宙 更新时间:2023-11-04 01:23:36 25 4
gpt4 key购买 nike

<分区>

所以问题是:

Write a program that accepts as input a sentence in which all of the words are run together but the first character of each word is uppercase. Convert the sentence to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example the string "StopAndSmellTheRoses." would be converted to " Stop and smell the roses."

到目前为止,我对我的代码感到很困惑。

def main():

#User enters a sentence
my_string=input('enter a sentence: ')
print(my_string.capitalize())

main()

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com