Hey there! Sign in to join this conversationNew here? Join for free
 You are Here: Home >< GCSEs

# Python calculating surface area of walls, HELP! What is wrong with my code? watch

1. *What is wrong with my code? It only calculates the surface area for one of the walls and not the others, what am I doing wrong!? Please help ASAP
print("Welcome to the estimation menu!")
global total
global NumberOfRooms
global NumberOfWalls
global SurfaceArea

CustomerNumber = input("What is your customer number?: ")
DateOfEstimation = input("What is your date of estimation?: ")

def estimation():
NumberOfRooms = 0
counter = 0
total = 0
NumberOfWalls = 0
SurfaceArea = 0
height = 0
width = 0
TotalHeightOfWalls = 0
TotalWidthOfWalls = 0

NumberOfRooms = int(input("How many rooms would you like painted?: "))
counter = int(NumberOfRooms) + int(counter)
while int(counter)>0:
name = input("What is the name of the room you would like painted? For example, dining, lounge, bedroom etc. : ")
wallpaper_removed = input("Do you want the wall paper to be removed? Type 'Yes' or 'No': ")
if wallpaper_removed == "Yes":
total = int(total) + 70
numberofwalls = int(input("Please enter the number of walls you would like painted for this room: "))
while int(numberofwalls) > 0:
height = int(input("What is the height of the wall? (In Meters): "))
width = int(input("What is the width of the wall? (In Meters): "))
numberofwalls = int(numberofwalls) - 1
counter = int(counter)-1
TotalHeightOfWalls = int(TotalHeightOfWalls + height)
TotalWidthOfWalls = int(TotalWidthOfWalls + width)
SufaceArea = (TotalWidthOfWalls * TotalHeightOfWalls)
print("Total Surface Area of walls =",SufaceArea)
estimation()
#You just need to ask for the height and width, then add it to the total
2. Everything on line 2 is written
3. (Original post by luis2201)
Everything on line 2 is written
What do you mean?
4. You could try using the 'else / elseif' function

It might also be due to the fact that you haven't integrated 'global total' in the second line at the end.

Reply
Submit reply
TSR Support Team

We have a brilliant team of more than 60 Support Team members looking after discussions on The Student Room, helping to make it a fun, safe and useful place to hang out.

This forum is supported by:
Updated: February 18, 2016
Today on TSR

### Tuition fees under review

Would you pay less for a humanities degree?

### Can I get A*s if I start studying now?

Discussions on TSR

• Latest
Poll
Useful resources

## Study tools

### Essay expert

Learn to write like a pro with our ultimate essay guide.

### Thinking about uni already?

See where you can apply with our uni match tool

### Ask a question

Chat to other GCSE students and get your study questions answered.

### Make study resources

Create all the resources you need to get the grades.

### Create your own Study Plan

Organise all your homework and exams so you never miss another deadline.

### Resources by subject

From flashcards to mind maps; there's everything you need for all of your GCSE subjects.

### Find past papers

100s of GCSE past papers for all your subjects at your fingertips.

## Help out other students

Can you help? Study help unanswered threads

## Groups associated with this forum:

View associated groups
Discussions on TSR

• Latest

The Student Room, Get Revising and Marked by Teachers are trading names of The Student Room Group Ltd.

Register Number: 04666380 (England and Wales), VAT No. 806 8067 22 Registered Office: International House, Queens Road, Brighton, BN1 3XE

Write a reply...
Reply
Hide
Reputation gems: You get these gems as you gain rep from other members for making good contributions and giving helpful advice.