5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

九九を表示するプログラム

Posted at

九九を表示するプログラム

99_1.py
for j in range(1,10):

    str_answer = ''
    
    for i in range(1,10):
        answer=j*i
        str_answer += "\t" + str(answer)
    
    print(str_answer)

Python 3.7.9 Shell 2022_08_20 11_33_02.png

感想

str_answer = str(answer)だと一番右の数字のみ表示されるけれど、
str_answer += str(answer)にすると1から9の全部の結果が表示できることに気づいた。
又、str(answer)の前に\tを入れることで空間を開けられることを知った。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?