[Tutor] coding problem

Alan Gauld alan.gauld at yahoo.co.uk
Thu Oct 4 04:09:13 EDT 2018


On 04/10/18 05:22, ramanpreet baidwan wrote:
> Can anyone tell me how to code to display permutations in a table 
> for all values of z=x^2+y by getting input from user for range of x and y?

There are several problems with your question.
First it sounds suspiciously like homework and
we won't do that for you.
(Although we will give you some pointers)

Second permutations sounds like the wrong word.
I suspect you just want all the solutions for
z displayed in a table against x,y pairs.
Is that correct?

Next, taken literally, the problem is impossible
since x,y have an infinite number of values. So to
have any chance you need to define the quantum
steps between x and y - integers, 0.1, 0.01, etc.
Otherwise you need to draw a graphical representation
rather than use a table.

Finally, its not clear what you are asking for help with.
Do you not know how to present output in a table format?
Do you not know how to calculate z?
Do you not know how to prompt the user for inputs?
Do you not know how to generate the x,y values from
the users input?

It's best if you can write some code then send us
that along with the output (including full error
message, if any). Then ask a specific question about
what is going wrong and how you want us to help.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list