長文を表示するプログラム 応援する  一行で表示する文字数が多い場合それを同じライン上で書くとコードが読みにくくなる場合があります.
この場合の修正方法を学んでいきましょう.
print関数を一回だけ使い,
There are 10 types of people in this world. Those who understand binary and those who don't. Which one are you?
という文章を表示するとしましょう.
しかし同じライン上で書くとコードが読みにくくなってしまいます.
この場合以下のようにコードを書くこともできます.
--この用にコードを書くこともできる
print("There are 10 types of people in this world." ..
"Those who understand binary and those who don't." ..
"Which one are you?" )
..という部分に注目してください.
これは複数の文字列をつなぎ合わせるときに使用します.
詳細は次章で説明します.
実行結果
There are 10 types of people in this world.Those who understand binary and those who don't.Which one are you?
| |
|