안녕하세요, 저는 Python에 처음 생겼고 선생님은 여러 함수가있는 함수를 만들길 원했습니다. 는 여기에 내가 나가서 설명하자면 NameError 또는 결과 중 하나가 오류를 정의되지 않은 얻을 Python 프로그래밍 여러 함수 사용
def main():
carpetyards = float(input("Enter amount of yards the carpet is"))
carpetcost = 5.50 * carpetyards
fee = carpetcost + 25.00
tax = .06 * fee
totalcost = fee + tax
results()
def results():
print()
print('carpetyards :' , format (carpetyards))
print('carpetcost :' , format (carpetcost, '9,.2f'))
print('fee :' , format (fee, '9,.2f'))
print('tax :' , format (tax, '9,.2f'))
print('totalcost :' , format (totalcost, '9,.2f'))
main()
처럼 내 프로그램 모습입니다. 누군가 제발 도와 줄 수 있니?
너무 일찍 호출하면 함수 정의 뒤에 함수 호출을 넣으십시오. –
교사에게 변수 범위에 관해 문의하십시오. 또한 들여 쓰기'results()'. – rlms
죄송합니다. 여러 함수를 사용하여 프로그램을 만들었습니다. – user3290698