카테고리 없음

[Phython]함수 활용 간단 예제

박강균 IT 2021. 12. 7. 11:31
#함수선언 

from os import read


def oneInput(msg) :
    num = float(input(msg))
    
    return num 

def twoInput() :
    width = oneInput('가로 입력')
    height = oneInput('세로 입력')
    
    return width,height

def rectArea() :
    rect = []
    if width == height : rect.append("정사각형")
    else : rect.append("직사각형")
    rect.append(width)
    rect.append(height)
    rect.append(width * height)
    
    return rect


rlist = []
width,height = twoInput()
rlist.append(rectArea())
print(rlist)