When I run the code, it results in this error
File "./test_1.py", line 110, in <module>
l,w=eval(input("Please enter length and width of room #"+str(x)))
TypeError: eval() arg 1 must be a string or code object
eval() is used to evaluate formulas or code so is not appropriate here and is generally considered bad practice as it will run anything that is entered i.e someone can enter a command to delete all of your files if they want to. Get the program to run first and then work on the room number problem. If you are using Python2.X (you didn't say) then input returns an integer so you can't separate the entries as that requires entering a non-integer character like a comma.
Formatting and concatenating strings http://www.diveintopython.net/native_data_types/formatting_strings.html
A Python2.x example
for i in range (5):
x=x+1
entry=raw_input("Please enter length and width of room ")
l,w = entry.split(",")
sum=sum+int(l)*int(w)
woooee
Posting Maven
2,705 posts since Dec 2006
Reputation Points: 827
Solved Threads: 779
Skill Endorsements: 9
You can use woooee's code, just replace raw_input with input
Ene Uran
Posting Virtuoso
1,830 posts since Aug 2005
Reputation Points: 676
Solved Threads: 255
Skill Endorsements: 7
Question Answered as of 1 Year Ago by
Ene Uran
and
woooee