# [Tutor] Newbie

Steve Willoughby steve at alchemy.com
Fri Jul 25 06:32:19 CEST 2008

```To answer the specific question about square roots below, Python's
square root function is in the math module.  You can either include this
module and invoke it like this:

import math
.
.
.
y = math.sqrt(x)

-or- if you want the sqrt() function brought into your main namespace,
you can do it like this:

from math import sqrt
.
.
.
y = sqrt(x)

Either way, y will now have the value of the square root of x.

HTH
HAND

>> ------------------------------
>>
>> Message: 9
>> Date: Thu, 24 Jul 2008 18:47:32 -0700 (PDT)
>> From: Sam Last Name <the_sam_smart at yahoo.com>
>> Subject: [Tutor]  Newbie
>> To: tutor at python.org
>> Message-ID: <370291.77091.qm at web59515.mail.ac4.yahoo.com>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> mmmkay its me again
>> Iv'e been learning alot and have found so much joy in making programs that solve equations using the input function.
>> I need Help on this though.
>> Im trying to make a program where it solves the quadratic formula when you put in the variables.
>> Here wats i got so far. :) and also, is there a function for square root?
>>
>> a  =  input("What is the variable a?")
>> b  =  input("What is the variable b?")
>> c  =  input("What is the variable c?")
>> # this is where i need help :(
>> print -b + /sqrt (b*b - 4*a*c)/(2*a)
>> # this of course doesn't work i believe because i don't have the square root function and don know how to make one
>>
>> Feedback appreciated :)
>>
>
> You're going to need to use your parenthesis differently.  You might have a problem with the grouping if you leave it as it is.  It'd be better written as this:
>
> print (-b + /sqrt ((b*b) - (4*a*c))/(2*a))
>
> I don't know the function for square root either, but I'm sure one of the others will answer that for you.
>
> -Jay
>
>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://mail.python.org/pipermail/tutor/attachments/20080724/b02787c9/attachment.htm>
>>
>> ------------------------------
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>> End of Tutor Digest, Vol 53, Issue 87
>> *************************************
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

```