スクリプトを実行すると、「売上が定義されていません」ということが続きます。明白な何かが欠落していますか?私はPythonの初心者です。より具体的には、「出品(販売、所有者)」という問題があります。私を助けてくれる人には感謝して、良い一日をお過ごしください。Python 3 - この変数がこの関数で定義されていないのはなぜですか?
def launch():
sales = [0] * 7
sales[0] = float(125900)
sales[1] = float(115000)
sales[2] = float(105900)
sales[3] = float(85000)
sales[4] = float(150000)
sales[5] = float(155249)
sales[6] = float(97500)
owner = [0] * 7
owner[0] = "Carson"
owner[1] = "Smith"
owner[2] = "Jackson"
owner[3] = "Swanson"
owner[4] = "Perry"
owner[5] = "Beufort"
owner[6] = "Anderson"
return sales, owner
def listing(sales, owner):
count = 0
count2 = 1
while count < 7:
print(count2 , "" , ":" , "" , "owner[count]\t" , "$" , "" , format(sales[count],',.2f'))
count = count + 1
count2 = count2 + 1
def main():
print("Welcome to the Botany Bay home sales calculator")
print("This program will calculate the average selling price of the homes")
print("sold this past year. It will then determine how many homes sold")
print("above the average and how many homes sold below the average.")
print("=======================================================================")
print("")
print("Botany Bay Home Sales")
print("*********************************")
listing(sales, owner)
launch()
main()