How do I use a while loop to add a variable every time it loops?
<p>I'm writing a program that tells the user to input the amount of rooms that a property has, and then a while loop finds out the width and length of each room. I feel like I need the while loop to create two extra variables to store the width and length every time it iterates, however I can not figure out how.
here is my code so far:</p>

<pre><code>roomCount = 1
print("Please answer the questions to find the floor size.")
rooms = int(input("How many rooms has the property got?:\n"))
while roomcount &gt;= rooms:
    print("For room", roomcount,", what is the length?:\n")
</code></pre>

<p>Its not much, but I have been searching the internet and haven't found out how.</p>

<p>What I would like the program to do is to ask the user how many rooms the property has and then for each room it should ask for the width and length of the room. The program then should display the total area of the floor space in a user friendly format</p>

<p>updated code:</p>

<pre><code>currentRoomNumber = 0
currentRoomNumber2 = 0
floorspace = 0
whileLoop = 0
print("Please answer the questions to find the floor size.")
numberOfRooms = int(input("How many rooms has the property got?: "))
roomWidths= list()
roomLengths = list()
while currentRoomNumber &lt; numberOfRooms:
    roomWidths.append(int(input("For room " + str(currentRoomNumber + 1) + ", what is the width?: ")))
    roomLengths.append(int(input("For room " + str(currentRoomNumber + 1) + ", what is the length?: ")))
    currentRoomNumber += 1

while whileLoop &lt; numberOfRooms:
    floorspace += (roomLengths[(currentRoomNumer2)] * roomWidths[(currentRoomNumber2)])
    currentRoomNumber2 += 1
    whileLoop += 1

print(floorspace)
</code></pre>

<p>However, after inputting the values of the room dimensions, it gives me a traceback error on line 15 and says <code>currentRoomNumber2</code> is not defined. Where have I gone wrong?</p>