日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 程序耗时记录_Python学校的学生身高记录程序

發布時間:2025/3/11 python 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 程序耗时记录_Python学校的学生身高记录程序 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

python 程序耗時記錄

A team of 5 people is assigned with a task to record the heights of students in a school and they have decided to make a python program using class to record all the student's height.

由5人組成的小組負責記錄學校中學生的身高,他們決定使用課堂制作python程序來記錄所有學生的身高。

In the below program, we try to use class in python to build a Student Height Record program for a school. The Record will contain the student’s name along with its height. This article aims to develop an understanding of the usage of class in the student height record system.

在下面的程序中,我們嘗試使用python中的class來為學校構建Student Height Record程序 。 記錄將包含學生的姓名及其身高。 本文旨在加深對學生身高記錄系統中班級用法的理解。

Program:

程序:

# definig a class student, # which contain name and height of the studentclass Student(object):def __init__(self, name, height):self.name = nameself.height = heightdef getheight(self):return self.heightdef __str__(self):return self.name + ' : ' + str(self.getheight())# Defining a function for building a Menu # which generates list of Food def HeightRecord(rec, name, height):rec.append(Student(name, height))return recRecord = [] x = 'y' while x == 'y':name = input('Enter the name of the student: ')height = input('Enter the height recorded: ')Record = HeightRecord(Record, name, height)x = input('another student? y/n ')n = 1 for el in Record:print(n,'. ', el)n = n + 1

Output

輸出量

Enter the name of the student: Prerana Jain Enter the height recorded: 165 another student? y/n y Enter the name of the student: Monika Sharma Enter the height recorded: 167 another student? y/n y Enter the name of the student: Shivang Yadav Enter the height recorded: 170 another student? y/n y Enter the name of the student: Radib Kar Enter the height recorded: 169 another student? y/n n 1 . Prerana Jain : 165 2 . Monika Sharma : 167 3 . Shivang Yadav : 170 4 . Radib Kar : 169

翻譯自: https://www.includehelp.com/python/student-height-record-program-for-a-school.aspx

python 程序耗時記錄

總結

以上是生活随笔為你收集整理的python 程序耗时记录_Python学校的学生身高记录程序的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。