[英]I am not getting output in the fucntion below why?
s = input()
k=input()
def string():
n=0
index=0
while (k+n)<len (s):
string= s[index:(k+n)]
index+=1
n+=1
return string
I want to return the substrings of the input string我想返回输入字符串的子字符串
First of all indent the code首先缩进代码
s = input()
k=input()
def string():
n=0
index=0
while (k+n)<len (s):
string= s[index:(k+n)]
index+=1
n+=1
return string
afterwards make sure when your calling the function make use of print function Ex print(string())
之后确保当您拨打 function 时使用 print function Ex print(string())
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.