ex33.py

Exercise33(append, while-loops, def, input, for-loops)

Exercise33(append, while-loops, def, input, for-loops)

Convert this while-loop to a function that you can call, and replace 6 in the test (i < 6) with a variable.

Exercise33(append, while-loops, def, input, for-loops)

注意: 如果直接amount = input(),则amount是字符,在while中不能与数字做比较会报错,如下:

Exercise33(append, while-loops, def, input, for-loops)

所以应该用amount = int(input())。


用for-loops and range 改写:

Exercise33(append, while-loops, def, input, for-loops)

此时不需要incrementor。

相关文章:

  • 2021-06-23
  • 2021-12-11
  • 2022-01-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-14
  • 2021-07-15
猜你喜欢
  • 2022-02-01
  • 2022-01-21
  • 2021-10-18
  • 2021-07-04
  • 2021-10-03
  • 2022-12-23
相关资源
相似解决方案