Just drop the indent on the print statement.
sum=0.0
for i in range(1,6):
x,y=eval(input("Please enter length and width of room:"))
sf=(x*y)
sum=sum+sf
print("The total square footage is",sum)
<<>strong>edited:
这是一种常见的做法,你可以用来实现你想要的东西:
sum=0.0
for i in range(1,6):
x,y=eval(input("Please enter length and width of room %i:" % i ))
sf=(x*y)
sum=sum+sf
print("The total square footage is %i" % sum )
What i m doing here is placing a wildcard in the middle of the string and then pass the parameters. %i tells the % operator that you are going to insert an integer. You can also put %s if you were going to add a string. There are a couple more you can check out. This is another example for the console:
>>> user_name = mauricio
>>> sum = 42
>>> line_to_print = Hello user %s, your sum is %i % (user_name, sum)
>>> print(line_to_print)
Hello mauricio, your sum is 42