2024-04-25 03:57:26 发布
网友
我从一小时前就开始尝试这段代码,它的输出真的出乎意料
var=input('sentence') no=1 for i in var: if i==" ": #i've added a space as the number of words will be the number of spaces in a sentence no+=1 print(no)
你忘了在你的if语句的末尾加上:号。以下方面应起作用:
var=input('sentence') no=1 for i in var: if i==" ": no+=1 print(no)
你忘了在你的if语句的末尾加上:号。以下方面应起作用:
相关问题 更多 >
编程相关推荐