Visualising factors

☆樱花仙子☆ 提交于 2019-12-02 13:35:10
Sharon Dwilif K

I am not going to give the complete code, since this is clearly an homework assignment.

But here is a pseudo algorithm that can get you started -

  1. You would need two for loops, one nested inside the other. The first for loop for going over the rows, second inner for loop for going over the columns.

  2. Inside the nested for loop, you would need to check whether the counter for inner for loop is divisible by the counter variable of the outer for loop, if it is you need to print * without giving a new line (To do this you can use end='' argument in Python 3 , or use , after what you want to print in Python 2), if not divisible print -.

  3. Finally after completing the inner loop, you would need to print another newline, so that the next row starts at next line.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!