本サイトAIZU ONLINE JUDGE ITP1_1_A へは以下から
問題:Hello World
“Hello World” と標準出力にプリントするプログラムを作成してください。
Input
この問題に入力はありません。
Output
“Hello World” と一行に出力してください。
解答例
print("Hello world")
解説
Pythonにおいて文字列を表示するためには、print
関数を使用します。そして、表示したい文字列は文字列型として扱われるため、ダブルクォーテーション("
)もしくはシングルクォーテーション('
)で囲む必要があります。
したがって、以下の2つの方法で”Hello World”を表示することができます。
ダブルクォーテーションを使用する方法:
print("Hello World")
シングルクォーテーションを使用する方法:
print('Hello World')
どちらの方法も同じ結果、すなわち”Hello World”という文字列を標準出力に表示することができます。
あわせて読みたい


【python】print関数の使い方
python公式ドキュメントはこちら Pythonで用意されている組み込み関数の中の print 関数の使い方です。引数に指定した文字列や数値、変数に格納された値などを標準出力…
次の問題へ
あわせて読みたい


AIZU ONLINE JUDGE ITP1_1_Bをpythonで解いてみた
本サイトAIZU ONLINE JUDGE ITP1_1_B へは以下から 問題:x の 3 乗 1つの整数 x を読み込んで、x の3乗を計算し結果を出力するプログラムを作成して…
一覧へ
あわせて読みたい


AOJ 「ITP I」40問をpythonで解いてみた
本記事では「レッドコーダーが教える、競プロ・AtCoder上達のガイドライン【初級編:競プロを始めよう】」で紹介されているAOJの「Introduction To Programming I」の40…
コメント