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 student
class Student(object):
def __init__(self, name, height):
self.name = name
self.height = height
def getheight(self):
return self.height
def __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 rec
Record = []
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学校的学生身高记录程序相关推荐

  1. 力扣 -- 551. 学生出勤记录 I 、 552. 学生出勤记录 II

    目录 551. 学生出勤记录 一 .题目描述 二. 实现思路以及代码 552. 学生出勤记录 II 一 .题目描述 二. 实现思路以及代码 551. 学生出勤记录 一 .题目描述 给你一个字符串 s  ...

  2. python打造记账本_python实现日常记账本小程序

    python实现收支的自动计算,能够查询每笔账款的消费详情,具体内容如下 1.函数需要两个文件:一个类似钱包功能,存放钱:另一个用于记录每笔花销的用途 #!/usr/bin/env python im ...

  3. python编程单词排序_Python读取英文文件并记录每个单词出现次数后降序输出示例...

    本文实例讲述了Python读取英文文件并记录每个单词出现次数后降序输出.分享给大家供大家参考,具体如下: 对文中出现的句号,逗号和感叹号做了相应的处理 sorted排序函数用法: 按照value值降序 ...

  4. python开发windows界面_python适合windows的桌面应用程序开发吗?

    谢... 谢特!... (自己跑过来的). 曾经从事过几个桌面应用程序的开发, 来提供些建议 Qt 的 signal-slot 的机制做得很不错, 充分理解以后开发起来很顺手. 早期项目里, 举个栗子 ...

  5. 用python解决生活问题_Python解决生活问题之闹钟程序的实现

    昨天下班回家忘了带手机充电器,手机熄火没闹钟了,可现实是迟到30分钟以内要罚100RMB,超过30分钟算旷工要扣除3天工资,想想这代价,好吧,还是自己动手写一个闹钟程序吧! 系统环境: Linux M ...

  6. python的应用图标_python实现根据图标提取分类应用程序实例

    本文实例讲述了python实现根据图标提取分类应用程序,分享给大家供大家参考. 具体方法如下: #!/usr/bin/python # -*- coding: utf-8 -*- import Ima ...

  7. python程序内存分析_python 如何测量运行中的程序内存 -- Valgrind

    介绍 通常我们可以用python profiler去分析应用程序中哪个模块被多次调用和那个程序部分运行的速度较为缓慢,但是并不能够准确给出我们应用程序在运行中在内存中占用的大小. 比如说在金融数据中会 ...

  8. python socket recv超时_python使用多线程编写tcp客户端程序,你还没掌握吗?

    这篇文章主要为大家详细介绍了python使用多线程编写tcp客户端程序,具有一定的参考价值,感兴趣的小伙伴们可以参考一下 在网上浏览的时候发现很多关于此题目的程序都只能接收数据,所以随便找了个程序研究 ...

  9. python秒表游戏代码_python编程实战:制作秒表程序

    现如今生活节奏的加快,再加个人们对营养的需求也是在不断加大.我们平时所食用的食物只有在它烹饪到刚刚好的时候才会把它自身的营养充分的发挥出来,可是我们一般对于它的时间方面不是很好把握,所以对于这一点,秒 ...

最新文章

  1. zabbix服务端远程执行命令
  2. cubemx stm32 配置两个串口_STM32CubeMX系列教程5:串行通信(USART)
  3. flutter怎么手动刷新_Flutter 小技巧实现通用的局部刷新
  4. 2.1.4 Python单例模式
  5. solidworks迈迪设计宝_做非标机械设计必备的辅助工具,如米思米、怡合达、英科宇等...
  6. 微软更新补丁下载地址
  7. win10变win7bios如何设置?
  8. 第十九周学习周报(20180709-20180715)
  9. 单片机三角波c语言程序,三角波单独发生 单片机程序
  10. 数据挖掘#金融风控总结
  11. abaqus script提取应力应变位移 odb学习 addData
  12. 某预约系统分析 某区公共自行车租车卡在线预约,关于如何提高成功概率
  13. Launcher3之应用卸载过程分析
  14. vue3 setup 怎么获取vue实例上的全局变量
  15. python日常记账本源代码,基于PySide6,支持快速查询、绘制图表
  16. c语言单元测试及答案,C语言程序设计单元测试答案
  17. Windows下的Eclipse启动报错
  18. 报表/BI工具选型重点注意事项和验证技巧分享
  19. 使用ffmpeg随意剪辑、合并视频片段
  20. plsql 客户端字符集_plsql软件字符集 plsql字符集设置utf8

热门文章

  1. svn版本库浏览器_在SVN版本库浏览器中直接编辑文件保存后不会弹..._网络编辑_帮考网...
  2. oracle数据库连接名是什么,连接到Oracle数据库的几种命名方式
  3. 哈哈机器人送到冰雪小镇_从小镇到上海:两代人的接力洄游 | 活动回顾
  4. aop注解配置切点 spring_springboot aop 自定义注解方式实现一套完善的日志记录
  5. 九个案例简述Web设计原则:简洁清晰
  6. Windows 7 资源管理器搜索Channel 9 视频
  7. 物联网听起来像是一个和互联网不同的网,万物互联又把网给弄丢了,正向我们扑面而来的是万物互联网。...
  8. UVA 12501 Bulky process of bulk reduction ——(线段树成段更新)
  9. android decorView详解
  10. 路由器ospf动态路由配置