一个有趣python self的题目
来源:互联网 发布:剑指offer python 编辑:程序博客网 时间:2024/06/08 05:40
#-*- encoding:utf-8 -*-
class
Box:
count
=
0
def
__init__(
self
,length,width,height):
self
.length
=
length
self
.width
=
width
self
.height
=
height
Box.count
=
Box.count
+
1
def
output(
self
):
self
.__v
=
self
.length
*
self
.width
*
self
.height
print
"length:"
+
str
(
self
.length)
print
"width:"
+
str
(
self
.width)
print
"height:"
+
str
(
self
.height)
print
"V:"
+
str
(
self
.__v)
print
"run times:"
+
str
(Box.count)
b1
=
Box(
1
,
2
,
3
)
b1.output()
b2
=
Box(
2
,
3
,
4
)
b2.output()
b3
=
Box(
3
,
4
,
5
)
b3.output()
b4
=
Box(
4
,
5
,
6
)
b4.output()
b5
=
Box(
6
,
7
,
8
)
b5.output()
阅读全文
0 0
- 一个有趣python self的题目
- 一个有趣的题目
- 一个有趣的题目
- 一个有趣的网络协议的题目
- if---else----一个有趣的题目
- 一个十分有趣的字符串算法题目
- 一个很有趣的javascript题目
- python题目-----python的12个有趣问题
- 一个有趣的python排序模块:bisect
- [Python]一个有趣的库:pipe
- [Python]一个有趣的库:pipe
- python:一个比较有趣的脚本
- 一道有趣的题目
- 一些有趣的题目
- 一道有趣的题目
- 有趣的题目
- 有趣的智力题(题目)
- bzoj有趣的题目
- 第十二周 【项目5
- 11月英语总结
- 每日一练-12
- Hadoop+spark+hive全分布环境的搭建
- 走穿java23钟设计模式-11外观模式
- 一个有趣python self的题目
- 第十三周 【项目1
- Linux常用指令
- 模糊图像退化与去模糊的数学模型
- <每日一题>最大回文子字符串
- springMVC容器和Spring容器
- unity3d保存文件到本地and加载本地文件
- Struts2的Ajax输入校验
- 【NOI 2015 软件包管理器】【树剖】