Assignment 2: Room Area

assignment 2 room area python answers

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Beginner Python Area of a room

Right now I am working on a program to calculate the area of a room in order to purchase cans of paint. I am just a three weeks into my class and I'm a little overwhelmed. I'm having trouble figuring out how I am supposed to attach each wall/ceiling/window/door to a separate name such as 'WALL1 WALL2' etc and then being able to call those to a calculation. As far as I have gotten I can't seem to figure out how to write this variable. I am by no means asking for the code to the whole program, so we will take a look at just walls as an example. "John wants to calculate how much paint he needs for a whole house and has 57 walls with various sizes of each wall." How do I allow an unlimited amount of walls to be used while attaching each wall to its Length and Height? Or should I limit the amount of walls? Once I establish how many of these walls there are how do I attach each wall to its own name? Each 'name' will then be called into the final calculation. Here is what I have so far:

I have provided my Flowchart here as reference so hopefully it makes better sense what I am trying to explain.

Amerilys's user avatar

  • Sounds like you're looking for a loop. I suggest having a look at your textbook. –  TigerhawkT3 Commented Jan 22, 2017 at 1:24
  • And I strongly recommend you using class if you are allowed to. –  ᴀʀᴍᴀɴ Commented Jan 22, 2017 at 1:25
  • 4 I don't know how you're expected to write Python without learning any Python. –  TigerhawkT3 Commented Jan 22, 2017 at 1:29
  • 1 @Vincenzzzochi , because each area has some walls and windows and each of them have width and heights , I think class would be great here , but I am agree dictionary is good too , but the concept of class is more helpful –  ᴀʀᴍᴀɴ Commented Jan 22, 2017 at 1:45
  • 1 Just out of curiousity, what class are you taking? We'd like to recommend people avoid the heck out of this class because it's terrible. –  Wayne Werner Commented Jan 23, 2017 at 11:31

3 Answers 3

You can use a list or a tuple to store your walls ceiling etc. then its a matter of running a For loop to do the calculation. You may also want to use a dictionary if you want to call the items by name.

You can create Wall1, Wall2 etc using a simple string addition and put that in the dictionary rather than creating variables for each element.

If you clarify how you gonna accept the user input for all 57 walls etc. we can answer more accurately.

Kaveen Perera's user avatar

  • you say 'John wants to calculate how much paint he needs for a whole house and has 57 walls with various sizes of each wall'. So do you have to get all 57 walls sizes at once? or do you only need one wall at a time. Like lets say you let the user input the width, height and the type (wall, ceiling etc) then you output the calculated area and may be some type specific information? –  Kaveen Perera Commented Jan 22, 2017 at 1:57
  • @Amerilys do you have any prior programming knowledge at all in any language? –  Kaveen Perera Commented Jan 22, 2017 at 2:03
  • they would input the information for each wall one at a time. So it would ask how many walls do you have, so it knows a predetermined amount. Say it's six, it then prompts the user to input length and height for WALL1. Say I put in 13 length and 9 height. It should either do the calculation there and attached the result to WALL1 or hold the information to be calculated later. And I'm going with calculate now and hold the information to be called later. I'm taking an introductory class to HTML and CSS right now and I've messed around with some things prior but I've never learned. –  Amerilys Commented Jan 22, 2017 at 18:23

After our discussion in the comments, it appears that your real problem comes from not really understanding the relative difficulty of things yet . In large part that's because you don't really understand programming yet, you've just been making flowcharts in your class. There's a fair difference between flowcharts and programming, since with a flowchart you can just put something magic happens .

My first recommendation is to check out the Python style guide, called pep8 ). Most Python developers stick to this, and it will make your life easier when trying to communicate with us.

Next, you want to adjust your expectations. Trying to parse out a bunch of values from something like:

You can do it, but as a beginning developer it's a bit overwhelming. If you know regular expressions it's pretty trivial, but you don't, and they're not a beginning topic. Just remember the popular saying:

Developers see a problem and say, "Ah, I know, I'll use regular expressions!" Now they have two problems.

Most of the time they're the wrong thing, but occasionally they're the right thing. But as a beginner, they're not the right thing.

Instead, you should aim for something like this:

  • get the project name
  • ask the user for wall sizes. When they input an empty/blank string, that's the last wall size
  • ask the user for ceiling sizes (though you could include this in the wall sizes, no need to have them different). When they input an empty/blank string there are no more ceilings.
  • ask the user for the door sizes. Same thing about empty strings.
  • ask the user for window sizes. The same thing applies for ceiling vs walls.
  • combine the wall/ceiling sizes and subtract (door sizes + window sizes)

You can store the sizes in lists, e.g. walls = [[3, 4], [5, 9], [9, 9]] . Dealing with lists is something that you can learn in the Python tutorial, or many other tutorials on the Internet.

You can iterate (loop) over your lists and write that information to a file, if that's something that you want to do. Tutorials will also cover that.

If you take the above approach, you'll find that your project is much easier to complete. Good luck!

Wayne Werner's user avatar

Have you considered using pandas data frames to store each instance of Wall, Window and Ceiling? Then you multiply your columns Width by Length and store it in the column Surface .

Then you can simply use the groupby function to get your totals and add up the results, or simply sum the Surface columns.

Gelinator's user avatar

  • 4 The user is just learning how to ride a bicycle, and you want to put a BMW M3 in front of him/her with pandas and the concept of dataframes? –  kingstante Commented Jan 22, 2017 at 1:45
  • I come from R and use spreadsheet a lot, so I must admit I have a harder time not using them. Might be the accountant in me, but I get a better grasp on my data when they're in a matrix like object. –  Gelinator Commented Jan 22, 2017 at 1:51
  • If you read the flowchart the OP posted it's clearly not what the exercise is after. –  Wayne Werner Commented Jan 22, 2017 at 2:19

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged python or ask your own question .

  • The Overflow Blog
  • Masked self-attention: How LLMs learn relationships between tokens
  • Deedy Das: from coding at Meta, to search at Google, to investing with Anthropic
  • Featured on Meta
  • User activation: Learnings and opportunities
  • Preventing unauthorized automated access to the network
  • Feedback Requested: How do you use the tagged questions page?

Hot Network Questions

  • Do solar panels get less hot than objects of a similar color?
  • World's smallest Sudoku!
  • White (king and 2 bishops) vs Black (king and 1 knight). White to play and mate in 2
  • Seeking a Brisker-style shiurim book on Masechet Beitza (besides Birkat Avraham)
  • How do you measure exactly 31 minutes by burning the ropes?
  • Papersize - why does TeX add margins by default and how can I avoid them?
  • Switch or switches in the context of trains in American English?
  • Score the science points in 7 Wonders
  • What does "we are out"mean here?
  • Is it natural to say "could he" instead of "if he could"? E.g.: "Could he have cast himself in the part of Mr Copthorne, he would not have attempted…"
  • Story where the main character is hired as a FORTH interpreter. We pull back and realise he is a computer program living in a circuit board
  • Will a Palm tree in Mars be approximately 2.5 times taller than the same tree on Earth?
  • How to enable (turn on) a 5V power rail with a 3.3V MCU power rail?
  • Did Sauron refer to Morgoth as "Morgoth" (Sindarin for "Black Foe" or "Dark Tyrant")?
  • DTM and DSM from the same LAZ file - extent do not match
  • What is the origin of the many extra mnemonics in Manx Software Systems’ 8086 assembler?
  • Is my TOTP key secure on a free hosting provider server with FTP and .htaccess restrictions?
  • 2 NICs, PC is trying to use wrong one
  • Carpet pages from Leningrad Codex
  • What are major reasons why Republicans support the death penalty?
  • can 14ga wire be used off of a 20amp GFI
  • is it correct to say "can you stop clinking the cup of coffee"?
  • If I'm turning humans into crude oil, would removing their skeletons accelerate this process?
  • Why does Lebanon apparently lack aerial defenses?

assignment 2 room area python answers

  • For educators
  • English (US)
  • English (India)
  • English (UK)
  • Greek Alphabet

This problem has been solved!

You'll get a detailed solution from a subject matter expert that helps you learn core concepts.

Question: You are asked to create a Python program that will calculate the area of a room with the dimensions of Length =10 and the Width =12. Requirements 1. You must include the following Python statements: assignment, print, calculation, comment 2. The program must use the following data: Length =10 Width =12 3. Use Microsoft Word or IDLE to document the program 4.

student submitted image, transcription available below

let's break down the task into three steps:

Step 1: Create the python program file

answer image blur

Not the question you’re looking for?

Post any question and get expert help quickly.

Python Assignment Operator

Python assignment sequence unpacking, python chained assignments, python arithmetic operators, python integer arithmetic, python negative number division, python float arithmetic, python complex num operator, python compound assignment, python comparison operators, python logical operators, python in operator, python is operator, python convert kilometer to mile, python operator exercise 1, python operator exercise 2, python operator exercise 3, python variable swap two numbers using a single line of code.

Write a program that asks the user to enter the width and length of a room.

Once these values have been read, your program should compute and display the area of the room.

The length and the width will be entered as floating-point numbers.

Include units in your prompt and output message; either feet or meters, depending on which unit you are more comfortable working with.

Click to view the answer

Create a program that reads the length and width of a farmer's field from the user in feet.

Display the area of the field in acres.

Hint: There are 43,560 square feet in an acre.

A small deposit is added to drink containers to encourage people to recycle them.

Suppose drink containers holding one liter or less have a $0.10 deposit, and drink containers holding more than one liter have a $0.25 deposit.

Write a program that reads the number of containers of each size from the user.

Your program should continue by computing and displaying the refund that will be received for returning those containers.

Format the output so that it includes a dollar sign and two digits to the right of the decimal point.

The %.2f format specifier indicates that a value should be formatted as a floating-point number with 2 digits to the right of the decimal point.

Reading the cost of a meal ordered at a restaurant from the user.

Then your program will compute the tax and tip for the meal.

Use your local tax rate when computing the amount of tax owing.

Compute the tip as 18 percent of the meal amount (without the tax).

The output from your program should include the tax amount, the tip amount, and the grand total for the meal including both the tax and the tip.

Format the output so that all of the values are displayed using two decimal places.

The \ at the end of the line is called the line continuation character.

It tells Python that the statement continues on the next line.

Do not include any spaces or tabs after the \ character.

  • How it works
  • Homework answers

Physics help

Answer to Question #95687 in Python for austin

Need a fast expert's response?

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS !

Leave a comment

Ask your question, related questions.

  • 1. Write the code to input a number and print the square root. Use the absolute value function to make
  • 2. Assignment 2: Room Area Room shape For this lab you will find the area of an irregularly shaped r
  • 3. Let's play Silly Sentences! Enter a name: Grace Enter an adjective: stinky Enter an adjecti
  • 4. Write a cash register program that calculates change for a restaurant of your choice. Your program s
  • 5. A vacation rental property management company must file a monthly sales tax report listing the total
  • 6. Which function would you choose to use to remove leading and trailing white spaces from a given stri
  • 7. Draw a student schedule by using a while loop. You will ask the user for their first and last names,
  • Programming
  • Engineering

10 years of AssignmentExpert

Who Can Help Me with My Assignment

There are three certainties in this world: Death, Taxes and Homework Assignments. No matter where you study, and no matter…

How to finish assignment

How to Finish Assignments When You Can’t

Crunch time is coming, deadlines need to be met, essays need to be submitted, and tests should be studied for.…

Math Exams Study

How to Effectively Study for a Math Test

Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…

IMAGES

  1. Assignment 2: Room Area : r/projectstemanswer

    assignment 2 room area python answers

  2. Assignment 2: Room Area : r/projectstemanswer

    assignment 2 room area python answers

  3. Python Assignment 2A Answers

    assignment 2 room area python answers

  4. SOLUTION: Assignment 2 python basics

    assignment 2 room area python answers

  5. Assignment operators in python

    assignment 2 room area python answers

  6. Solved I need help with my python programming assignment.

    assignment 2 room area python answers

VIDEO

  1. NPTEL Data Analytics with Python Week 12 Assignment Answers

  2. NPTEL Data Analytics with Python Week 3 Assignment Answers

  3. E&T personnel review Area-02 Roblox

  4. Meeting Rooms III

  5. Python Data Structures Assignment 10.2 Solution [Coursera]

  6. Image Processing in Python with Scikits-image

COMMENTS

  1. Answer in Python for Assignment 2: Room Area #96157

    Answer to Question #96157 in Python for Assignment 2: Room Area 2019-10-08T09:57:57-04:00. Answers > Programming & Computer Science > Python. Question #96157. ... and get a quick answer at the best price. for any assignment or question with DETAILED EXPLANATIONS! Place free inquiry

  2. assignment 2: room area programming python in Project Stem

    Click here 👆 to get an answer to your question ️ assignment 2: room area programming python in Project Stem ... Add your answer and earn points. plus. Add answer +10 pts. Answer. 12 people found it helpful. profile. reyeslizbethamber. reyeslizbethamber. Helping Hand. 3 answers.

  3. Python/Assigment_2_Room_Area at master

    Automate any workflow. Packages. Host and manage packages. Security. Find and fix vulnerabilities. Codespaces. Instant dev environments. Copilot. Write better code with AI.

  4. Flashcards Assignment 2: Room Area

    Assignment 2: Room Area Quizlet has study tools to help you learn anything. Improve your grades and reach your goals with flashcards, practice tests and expert-written solutions today.

  5. this contains all the answers to the quizes and asssignments for

    this contains all the answers to the quizes and asssignments for "Programming for Everybody (Getting Started with Python)" on Coursera by the University of Michigan. - Ritik2703/Coursera---Programming-for-Everybody-Getting-Started-with-Python-

  6. Beginner Python Area of a room

    My first recommendation is to check out the Python style guide, called pep8). Most Python developers stick to this, and it will make your life easier when trying to communicate with us. Next, you want to adjust your expectations. Trying to parse out a bunch of values from something like: Wall 1 3x4 Wall 2 5x9 Wall 3 9x9 Door 1 2x6.5 Door 2 2x6.5

  7. Learn Python by Exercises #2: Area of a Room

    About Press Copyright Contact us Creators Advertise Developers Terms Privacy Policy & Safety How YouTube works Test new features NFL Sunday Ticket Press Copyright ...

  8. Edhesive assignment 2: room area

    Final answer: Option B is the correct approach to solve the code without using any inputs and having at least one print statement being the last line of the code.. Explanation: B) Implement a function that calculates the room area and call it with predefined values, then print the result.. Option B is the correct approach to solve the code. By implementing a function, you can pass in the ...

  9. Answer to Question #87539 in Python for Timothy

    Assignment 2: Room Area Room shape For this lab you will find the area of an irregularly shaped room with the shape as shown above. ... Answer to Question #87539 in Python for Timothy 2019-04-04T06:28:50-04:00. Answers > Programming & Computer Science > Python. Question #87539.

  10. courses-introduction-to-python/chapter2.md at master

    Contribute to datacamp/courses-introduction-to-python development by creating an account on GitHub. ... The number representing the area of the living room is the 6th element in the list, so you'll need [5] here. area[4] ... Follow the code sample in the assignment. x is areas here, and ["e", "f"] ...

  11. Answer in Python for kylie willis-bixby #95689

    For this lab you will find the area of an irregularly shaped room with the shape as shown above. A; 2. Write the code to input a number and print the square root. Use the absolute value function to make ; 3. Assignment 2: Room Area Room shape For this lab you will find the area of an irregularly shaped r; 4. Let's play Silly Sentences!

  12. Solved You are asked to create a Python program that will

    Your solution's ready to go! Our expert help has broken down your problem into an easy-to-learn solution you can count on. See Answer See Answer See Answer done loading

  13. Python Operator Exercise 1

    Question 1. Write a program that asks the user to enter the width and length of a room. Once these values have been read, your program should compute and display the area of the room. The length and the width will be entered as floating-point numbers. Include units in your prompt and output message; either feet or meters, depending on which ...

  14. Edhesive assignment 2: room area?

    Edhesive assignment 2: room area? Get the answers you need, now! Skip to main content. search. Ask Question. Ask Question. Log in. Log in. Join for free. menu. close. Test Prep New. Brainly App ... The calendar program in Python, where comments are used to explain each line is as follows: #This checks for leap year. def leap_year(y): if y % 4 == 0:

  15. Answer in Python for Nicholas A Fietsch #95447

    Answer to Question #95447 in Python for Nicholas A Fietsch 2019-09-27T17:02:30-04:00. Answers > Programming & Computer Science > Python. Question #95447. Assignment 2: Room Area Room shape For this lab you will find the area of an irregularly shaped room with the shape as shown above.

  16. applied-machine-learning-in-python/Assignment+2.ipynb at master

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  17. Assignment 2: Room Area edhesive

    write (T) for true answer and (F) for false answer: The middle layer in computer system is operating system just in computer subject what is a meaning of font family A an dash is the set of the instruction right in a simple language to solve a problem

  18. Assignment 2: room area CS python fundamentals project stem

    Find an answer to your question assignment 2: room area CS python fundamentals project stem ... Select the correct answer from each drop-down menu. Complete the sentences that describe the best practices related to website architecture. _____ chevron left. Previous. chevron right.

  19. Answer to Question #95794 in Python for eva

    For this lab you will find the area of an irregularly shaped room with the shape as shown above. A; 6. Write the code to input a number and print the square root. Use the absolute value function to make ; 7. Assignment 2: Room Area Room shape For this lab you will find the area of an irregularly shaped r

  20. Assignment 2: Room area

    Click here 👆 to get an answer to your question ️ Assignment 2: Room area

  21. Answer to Question #95687 in Python for austin

    Remember the formula for finding the area of a rectangle is length * width and the area of a right triangle is 0.5 * the base * height. Please note the final area should be in decimal format. Sample run: Enter side A: 11. Enter side B: 2. Enter side C: 4. Enter side D: 7. Enter side E: 1. Output: