Hello here is my code:
def main():
#Define Variables
HomesSold = [0]
Amount = 0
HomePrice = [0]
Amount = GetAmount(Amount)
HomesSold = AmountHomesSold(Amount)
#print(HomesSold)
def GetAmount (Amount):
global amount
ConvertAmount = float()
ErrorFlag = False
Amount = input("Enter the amount of homes sold this year:")
while not Amount.isdigit():
Amount = input("Please try again, make sure you are entering a positive number (No commas needed): ")
print("The amount of houses sold were: ",Amount)
ConvertAmount = float(Amount)
return ConvertAmount
def AmountHomesSold(HomePrice):
HomePrice = 0
index = 0
while (index < Amount):
HomePrice = GetHomePrice()
HomesSold[index] = HomePrice
index = index + 1
print(HomePrice)
return HomePrice
def GetHomePrice():
HomePrice = input("How much did the homes sell for?")
while not HomePrice.isdigit():
HomePrice = input("Please try again, make sure you are entering a positive number (No commas needed): ")
return HomePrice
main()
So when I try to set my while statement for index < amount, I keep getting an error saying amount is not defined when it is earlier on in my code. Is there a way I can receive that number?