Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7736945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T07:52:25+00:00 2026-06-01T07:52:25+00:00

I need to write this program using a loop https://i.stack.imgur.com/gko6T.jpg this is what i

  • 0

I need to write this program using a loop

https://i.stack.imgur.com/gko6T.jpg

this is what i have so far but my program has to look exactly and the picture???

def main():

    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)

main()

Thank you for your help…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T07:52:26+00:00Added an answer on June 1, 2026 at 7:52 am

    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)
    

    edited:

    This is a common technique in python you could use to achieve what you want:

    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that looks like this. I need to consistently write something
I have this Structure the elements of which that I need to write in
i have to make a notepad where i write,edit,clear the text. this notepad need
I need to write a program that displays this information: netstat TCP / UDP
I have this question: Write a program to display the sum of the series
I am new in java programming. I have write a small web program using
I need to write a program using lc3 that takes user input and then
I have a C program and I need to test it using a file
I need to write a macro that operates on bitarray looking like this: array[0]
Problem: I need to write/read objects from a file.This because I need to write/read

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.