[Tutor] Newbie

kinuthiA muchanE muchanek at gmail.com
Fri Jul 25 09:13:53 CEST 2008


On Fri, 2008-07-25 at 03:47 +0200, tutor-request at python.org wrote:
> 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
>>> import math
>>> print math.sqrt(6)
2.44948974278
>>> print math.sqrt(8)
2.82842712475
>>> 
math is a module which contains most of  the mathematical functions that
you need most of the time. Here we used just one of them, sqrt, to find
the square root of an integer. The Python Library Reference lists all of
them and their usage.
Does this help?
Kinuthia...




> 
> Feedback appreciated :)



More information about the Tutor mailing list