当前位置: 首页>>代码示例>>Python>>正文


Python Circle.diameter方法代码示例

本文整理汇总了Python中circle.Circle.diameter方法的典型用法代码示例。如果您正苦于以下问题:Python Circle.diameter方法的具体用法?Python Circle.diameter怎么用?Python Circle.diameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在circle.Circle的用法示例。


在下文中一共展示了Circle.diameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_change_diameter

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_change_diameter():
    c = Circle(2)

    assert c.radius == 2
    assert c.diameter == 4

    c.diameter = 6
    assert c.radius == 3
    assert c.diameter == 6
开发者ID:DZwell,项目名称:sea-c34-python,代码行数:11,代码来源:test_circle2.py

示例2: test_change_diameter_float

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_change_diameter_float():
    c = Circle(4)
    c.diameter = 11
    assert c.diameter == 11
    assert c.radius == 5.5
开发者ID:Anastomose,项目名称:IntroToPython,代码行数:7,代码来源:test_Circle.py

示例3: test_set_diamter

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_set_diamter():
    c = Circle(4)
    c.diameter = 11
    assert c.radius == 5.5
    assert c.diameter == 11
开发者ID:Anastomose,项目名称:IntroToPython,代码行数:7,代码来源:test_circle.py

示例4: test_set_diameter

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_set_diameter():
    c = Circle(4)
    c.diameter = 2
    assert c.diameter == 2
    assert c.radius == 1
开发者ID:katdev,项目名称:IntroPython2015,代码行数:7,代码来源:test_circle.py

示例5: test_set_diameter

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_set_diameter():
    c = Circle(4.3)
    c.diameter = 3.0
    assert c.radius == 1.5
    assert c.diameter == 3.0
开发者ID:Anastomose,项目名称:IntroToPython,代码行数:7,代码来源:circle_test.py

示例6: repr

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
print "the radius:", c.radius    
print "the diameter:", c.diameter
print "the area:", c.area
print "the repr():", repr(c)
print "the str():", str(c)

print
print "setting the radius to 2:"
c.radius = 2
print "the radius:", c.radius    
print "the diameter:", c.diameter
print "the area:", c.area

print
print "setting the diameter to 6:"
c.diameter = 6
print "the radius:", c.radius    
print "the diameter:", c.diameter
print "the area:", c.area

print
print "trying to delete the diameter"
try:
    del c.diameter
except Exception as err:
    print "Whoops:", err
    
print
print "trying to set the area"
try:
    c.area = 40.0
开发者ID:PythonCHB,项目名称:PythonIntroClass,代码行数:33,代码来源:test_circle.py

示例7: test_set_diameter

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_set_diameter():
    c = Circle(4)
    c.diameter = 10

    assert c.diameter == c.radius * 2
    assert c.diameter == 10
开发者ID:Anastomose,项目名称:IntroToPython,代码行数:8,代码来源:test_circle.py

示例8: test_diameter_set

# 需要导入模块: from circle import Circle [as 别名]
# 或者: from circle.Circle import diameter [as 别名]
def test_diameter_set():
    c = Circle(2)
    c.diameter = 6
    assert (6 == c.diameter)
    assert (3 == c.radius)
开发者ID:brendanfogarty27,项目名称:IntroPython2015,代码行数:7,代码来源:test_circle.py


注:本文中的circle.Circle.diameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。