Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 3 years have passed since last update.

Pythonの基本:Step7解答例

Last updated at Posted at 2021-09-04

#解答例

waist_list=[] #waist_listというリストを作る
for i in range(1,4):
    print(i,"人目")
    waist=float(input("腹囲は?"))

    waist_list.append(waist) #ここでwaistという変数の値をリストに追加している

l=len(waist_list) #waist_listというリストの件数
s=sum(waist_list) #waist_listというリストの合計
mean=s/l #合計を件数で割って平均を求めmeanという変数に代入

print("今回の腹囲の平均は",mean,"cmです")
0

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?