Homework Day04.2

这仅仅是一个作业在这里插入图片描述

class Rectangle(object):
    def __init__(self):
        pass
    def main(self):
        width = float(input("长为:"))
        heightd = float(input("宽为:"))
        self.getArea(width,heightd)
        self.getPerimeter(width,heightd)
    def getArea(self,width,heightd):
        Area = width * heightd
        print('面积为:%.2f'%Area)
    def getPerimeter(self,width,heightd):
        Perimeter = (width + heightd) * 2
        print('周长为:%.2f'%Perimeter)
if __name__ == '__main__':
    rectangle = Rectangle()
    rectangle.main()

在这里插入图片描述
我不会
在这里插入图片描述

class Fan(object):
    def __init__(self):
        pass
    def main(self):
        speed = int(input("1档,2档,3档"))
        on = bool()
        radius1 = float(5)
        radius2 = float(10)
        color1 = str('blue')
        color2 = str('yellow')
        self.gongneng(speed,on,radius1,radius2,color1,color2)
    def gongneng (self,speed,on,radius1,radius2,color1,color2):
        if speed == 1:
            print(on)
        elif speed == 2:
            print('半径为:',radius1,'颜色:',color1)
        elif speed == 3:
            print('半径为:',radius2,'颜色:',color2)
        else:
            pass
if __name__ == "__main__":
    fan =Fan()
    fan.main()

在这里插入图片描述

import math
class LinearEquation(object):
    def __init__(self):
        pass
    def main(self):
        n=float(input('输入边数:'))
        side = int(input('输入边长:'))
        self.isSolvable(n,side)
    def isSolvable(self,n,side):
        L = n*side
        Area = float((n*side**2)/4*math.tan(math.pi/n))
        print('周长为:',L,'面积为:%.2f'%Area)
if __name__ == "__main__":
    linearequation = LinearEquation()
    linearequation.main()

在这里插入图片描述

class LinearEquation(object):
    def __init__(self):
        pass
    def main(self):
        a = float(input('a= '))
        b = float(input('b= '))
        c = float(input('c= '))
        d = float(input('d= '))
        e = float(input('e= '))
        f = float(input('f= '))
        self.isSolvable(a,b,c,d,e,f)
    def isSolvable(self,a,b,c,d,e,f):
        if a*d-b*c ==0:
            print('此方程无解')
        else:
            x = (e*d-b*f)/(a*d-b*c)
            y = (a*f-e*c)/(a*d-b*c)
            print('x为:',x)
            print('y为:',y)
if __name__ == "__main__":
    linearequation = LinearEquation()
    linearequation.main()

在这里插入图片描述

class LinearEquation(object):
    def __init__(self):
        pass
    def main(self):
        x1,y1=eval(input('请输入第一条直线的第一个端点(逗号分隔)'))
        x2,y2=eval(input('请输入第一条直线的第二个端点(逗号分隔)'))
        x3,y3=eval(input('请输入第二条直线的第一个端点(逗号分隔)'))
        x4,y4=eval(input('请输入第二条直线的第二个端点(逗号分隔)'))
        self.math(x1,y1,x2,y2,x3,y3,x4,y4)

    def math(self,x1,y1,x2,y2,x3,y3,x4,y4):
        a = y2-y1
        b = x2*y1-x1*y2
        c = x2-x1
        d = y4-y3
        e = x4*y3-x3*y4
        f = x4-x3
        self.isSolvable(a,b,c,d,e,f)

    def isSolvable(self,a,b,c,d,e,f):
        y = float(a*e-b*d)/(a*f-c*d)
        x = float(y*c-b)/a
        print('交点的横纵坐标为:',(x,y))
if __name__ == "__main__":
    linearequation = LinearEquation()
    linearequation.main()

今天的作业就写完了接下来又到了每日更新头像的环节
在这里插入图片描述
在这里插入图片描述
现在是凌晨 1.25 Joker 你等着啊!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值