LoginSignup
1
0

More than 1 year has passed since last update.

210911_Pythonプログラミング教室

Posted at

演習問題①の解答

# 全ての果物の金額を変数に代入する
apple = 100
orange = 120

# 「税抜き価格は〇〇円になります」と出力する
non_taxed_price = apple * 2 + orange
print('税抜き価格は' + str(non_taxed_price) + '円になります')

# 「税込価格は〇〇円になります」と出力する
tax_included_price = int(non_taxed_price * 1.1)
print('税込み価格は' + str(tax_included_price) + '円になります')

演習問題②の解答

test_scores =[50, 65, 45, 75, 70]

# 解答1) 国語の点数(50点→80点)に書き換えてください
test_scores[0] = 80

# 解答2) 体育の点数(90点)を加えて出力してください
test_scores.append(90)
print(test_scores)

# 解答3) 「最低スコアは◯点、最高スコアは◯点です。」と出力してください
print("最低スコアは" + str(test_scores[2]) + "点、最高スコアは" + str(test_scores[-1]) + "点です。")

演習問題③の解答

test_scores_d ={'国語':50,'算数':65,'理科':45,'社会':75,'英語':70}

# 解答1) 国語の点数(50点→80点)に書き換えてください
test_scores_d['国語'] = 80

# 解答2) 体育の点数(90点)を加えて出力してください
test_scores_d['体育'] = 90
print(test_scores_d)

# 解答3) 「最低スコアは◯点、最高スコアは◯点です。」と出力してください
print("最低スコアは" + str(test_scores_d['理科']) + "点、最高スコアは" + str(test_scores_d['体育']) + "点です。")
1
0
1

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
1
0