Skip to content

Instantly share code, notes, and snippets.

@mohira
Created February 15, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohira/d7762735ec0bb394bee786b4aaac2113 to your computer and use it in GitHub Desktop.
Save mohira/d7762735ec0bb394bee786b4aaac2113 to your computer and use it in GitHub Desktop.
<?php
// 連想配列とif文の組み合わせ的なお題
// 難易度: ★★☆☆☆
// 3都府県のいくつかの駅名とある日の最高気温のデータを連想配列として持っています
$weather_information = [
['prefecture' => '東京都', 'station' => '渋谷', 'temperature' => 6.5],
['prefecture' => '東京都', 'station' => '池袋', 'temperature' => 7.0],
['prefecture' => '東京都', 'station' => '新橋', 'temperature' => 7.5],
['prefecture' => '大阪府', 'station' => '梅田', 'temperature' => 8.2],
['prefecture' => '大阪府', 'station' => '大阪', 'temperature' => 9.3],
['prefecture' => '大阪府', 'station' => '堺', 'temperature' => 8.5],
['prefecture' => '福岡県', 'station' => '博多', 'temperature' => 13.0],
['prefecture' => '福岡県', 'station' => '太宰府', 'temperature' => 15.0],
];
// Q1. '博多駅' と出力してください。
// Q2. '東京都渋谷駅の最高気温は10度でした' と出力してください。
// Q3. 全国の平均気温は?
// Q4. 福岡県の平均気温は?
// Q5. 大阪府のすべての駅名を半角スペース区切りで出力してね。
// Q6. 福岡県の久留米の最高気温は14.0度だったそうです。というわけで、このデータを追加してください。
// Q7. ???
// Q8. ???
// Q9. ???
// Q10. ???
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment