내가 학교 프로젝트를 위해 작성된 몇 가지 코드를 왜 이해가 안하지만 내 코드은 나가서 설명하자면 NameError가 나타나고 있지만
fullname = input("whats your name?")
print("hello",fullname,)
print("room 1")
width=input("how wide is the room?")
length=input("how long is the room?")
area = float(length)*float(width)
print("the total area is",area,)
q = input("do you want another room?")
if q == "yes":
print("room 2 ")
widtha=input("how wide is the room?")
lengtha=input("how long is the room?")
areaa = float(lengtha) * float(widtha)
print("the total area is",areaa,".")
else:
flooring=input("do you want to have wood flooring(10) or tiled flooring(15)")
if flooring == "wood":
costaa = float(area)+ float(areaa)*10
print("total cost is ",costaa,)
if flooring == "tiled":
costab = float(area)+ float(areaa)*15
print("total cost is £",costab,)
을 비용 부품의 모든에 오류를 표시 내가 선택한 것에 따라 정의된다.
areaa 변수가 else 문에 정의되어 있지 않습니다. 그것은 실행되지 않을 수있는 if 문을 정의합니다. 이해가되는지 모르겠다 –
파이썬 오류 메시지는 일반적으로 오류가 발생한 행을 표시합니다. –