题目要求:

Write a program that outputs the string representation of numbers from 1 to n.

But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. For numbers which are multiples of both three and five output “FizzBuzz”.

my answer:

测试错误分析

1 range(n)的使用,记住range(2)代表0,1 是从0开始的,所以上述遍历之后的 i 要变为 i+1

2 s%3==0 , 对于小于3的数也是成立的,所以这里分开讨论了

3 首先if 同时整除3和5的数,否则会出错

4 如果 output.append(“u”),直接加双引号会出错,输出"u" ,而不输出遍历的数字,所以需要用函数 str( )

最新文章

  1. 【项目管理】图解GitHub基本操作
  2. Linux Shell 流程控制语句
  3. JSBinding+Bridge.NET限制
  4. codeforces #270 ABCD
  5. SQL 游标使用实例
  6. Node快速安装
  7. sqlserver函数
  8. nedb nodejs 数据库学习
  9. pxecfg&kickstart生成脚本
  10. 快速同步mysql数据到redis中
  11. java-finalize
  12. Javascript和JQuery中常用的随机数产生函数
  13. 设置和取消git代理
  14. SHELL脚本--shell数组基础
  15. 省选前的JOI
  16. How to use Jackson to deserialise an array of objects
  17. vue(ajax:axios中文文档)
  18. OpenStack 图形化服务 Horizon介绍和部署(十二)
  19. Decorator - 装饰模式
  20. ios 解决Wkwebview闪烁问题

热门文章

  1. Sublime EMMET使用技巧
  2. 用@ExceptionHandler 来进行异常处理
  3. [转]Javascript 取小数点后面N位
  4. Oracle GoldenGate同步服务归档空间维护
  5. 高性能mysql:创建高性能的索引
  6. NodeJ node.js Koa2 跨域请求
  7. 使用 jTessBoxEditor 生成 tesseract-orc 的字典
  8. MySQL常用参数说明(持续更新)
  9. react-router-dom和本地服务本地开发 (node、webpack)
  10. JavaScript的兼容小坑和调试小技巧