1

http://tinypic.com/r/35lug3r/5

The sheet says write a pseudocode program but I've been told to do that + Python.

The question is in the link. I am not asking for a full solution, but for how I would approach it. I've just started Python so I'm not that good using it. I don't understand how a solution would be achieved considering no values have been given.

The sheet also says (not on the image) that you only need 3 of the 4 variables, which I also don't understand. (not assuming the panels are square)

2
  • 3
    If you don't understand the idea of a variable, learning what they are should be your first course of action. Have you at least taken algebra in school? Commented Feb 23, 2012 at 16:17
  • Write down an algebraic expression that calculates the answer. Commented Feb 23, 2012 at 16:57

2 Answers 2

1

The point of the question is to write a program that can calculate the answer given different input values. That's why you don't need any actual values - it's the algorithm it wants, not a particular numerical answer.

You probably want to define some test values though, and do the calculation manually, so you can check your code is working correctly.

Re: the 3 of 4 values, there appears to be an assumption that the fence panels will be used the "normal" way up, so the height is determined by the height of the panels. Either that, or you can use them either way round (which would be a bit odd, and would mean there are two possible answers for each input, unless the panels are square).

Sign up to request clarification or add additional context in comments.

3 Comments

Right, thanks. So it would require to enter their garden length, width and panel size and Python works out the number of panels?
I'm having a bit of mind blank. Mind starting me off? I can't visualize the image very well.
Try a numerical example first - if the gardenLength=4 and gardenWidth=2 and fencew=1, how many panels will you need? How did you work that out? That is your algorithm that you can apply to other input numbers.
0

I'd start by suggesting you use the four nouns in boldface as your variables. Try to think about how they are related, and express that algorithmically. It's a good exercise to solve this yourself. With a problem like this, start algebraically, and don't worry about coding. Once you have an algebraic expression that describes the correct relationship, then you can address coding it.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.