On 29/07/15 04:28, Job Hernandez wrote:
How is it going tutors?

You only sent it to me. Please use Reply All to include the list.


The following problem seems impossible to me:

"*Write a program that asks the user to enter an integer and prints two integers, /root /and /pwr/, such that 0 < pwr < 6 and root^pwr (root**pwr) is equal to the integer entered by the user. If no such pair of integers exists, it should print a message to that effect*."

I would like to solve this problem myself so please don't give me the solution.

I need to learn how in the world do find the root and power of an integer that x user entered? I haven been looking on the python website for an appropriate function but I have not.

The only function you need is pow()
Or you could do it without a function by using the ** operator.

You want to try various integer values and see if the result is the users input.
That means you need a loop. The pwr value is set between 1 and 5 in the
assignment. The maximum root value will be the user's input (since X**1 = X,
and that will always be a valid solution!)

Is there a book you guys recommend for total beginners who have no
idea of what computer science and programming is?

Being biased, I'd recommend my web site(see below). You can get an older
version in a paper book if you must, and its mostly still applicable. There is
also a good option by Allen Downey which focuses on the CS side of things
if that's what you want.

hth

--
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

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to