热门标签:
1、在for循环中使用函数需要更长的执行时间,因为每次迭代都会调用该函数。
2、如果for循环是在函数内部实现的,那么该函数只会被调用一次。
实例
#创建一个函数,其中for循环在函数内部 defforinfunction(listofstrings): forxinlistofstrings: newstring=x.capitalize() outputstring=x+""+newstring print(outputstring)
版权:
转载请注明出处:https://www.bdoc.cn/180.html
分享
已经没有下一篇了!
还没有评论呢,快来抢沙发~
陆兴东
这家伙很懒,只想把你留下。
在线时间:9:00-16:00
799549999
还没有评论呢,快来抢沙发~