[Tutor] Abs

Chris Roy-Smith chris_roysmith at internode.on.net
Mon Jul 27 10:24:37 CEST 2015


On 27/07/15 11:06, Job wrote:
> I want to be able to ask a user to input an integer and print out the root and power of the given integer.
>
> Why do you use abs(x) for this program?
>
> I don't understand or see the link between abs() and root and powers.
>
> This reminds me of this:
> By knowing that when x%2==1 x is an odd number and when x%2 ==0 x is even, I was able to create a program that asked the user to enter 10 integers and printed out the largest odd number .
>
> So If I understand how and why abs() is used to find the cube root of a perfect cube or how to use abs() to make the computer print out the root and power of a given integer I may make this program.
>
> Thank you and forgive for my fuzzy thoughts.
>
> Job
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
You will fine that any attempt to find the root of a negative value will 
result in an error.


More information about the Tutor mailing list