CodeDrill
day_streak: --
← 問題一覧に戻る
Python ・ Standard I/O

Problem 15: Average to Two Decimal Places

You are given an integer N on the first line, and N integers separated by single spaces on the second line. Output their average, formatted to two decimal places, on one line.

For example, if the average is 2, output 2.00, and if it is 2.75, output 2.75.

Constraints

1 ≤ N ≤ 100, 0 ≤ each element ≤ 1000

Input example 1

3
1 2 3

Output example 1

2.00

Input example 2

4
1 2 3 5

Output example 2

2.75

What you'll train

Specify the output

What you get

  • Specify the number of decimal places
  • Explain the rounding method
  • Show an example of the output format

How to ask the AI

Clearly tell the AI that even if the average comes out to be a whole number, it must still be displayed with two decimal places, like 2.00, and specify whether to round or truncate.

If you ask vaguelyIf the average turns out to be a whole number, the AI might omit the decimal part and output just "2".

あなたのコード

実行しました

プレビュー

AIレビュー(プロンプト練習)

コードはChatGPTやClaudeに出させたものを貼って構いません。
ここでの本番は「次にAIへ出す指示」です。評価軸は1つだけ見て、弱点・指示の穴・改善例を返します。
テストに落ちていてもレビューできます。落ちた理由と、指示に足りなかった情報を結びつけます。

先にコードを実行し、テストを1つ以上通してください。