为什么要用函数

现在python届发生了一个大事件,len方法突然不能直接用了。。。

然后现在有一个需求,让你计算'hello world'的长度,你怎么计算?

这个需求对于现在的你其实不难,我们一起来写一下。

s1 = "hello world"
length = 0
for i in s1:
    length = length+1

print(length)
for循环实现len功能

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-03-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-16
  • 2021-11-02
  • 2022-01-10
  • 2021-05-20
  • 2021-06-06
相关资源
相似解决方案