2 forms to create Square root in Python

By kedinn 2013/09/19

It was always using the bookstore for a square root that is math then I was decided to create a square root without using bookstores we see as:

First form utlizando bookstore math:
very easy
line 1 is to concern the bookstore math for the root
line 2 to enter value by keyboard
line 3 we applied the operation, is where the bookstore in math.sqrt works
line 4 to print I number
okey we can improve the code ejm when they enter a negative showed error since it is only for real positives
we can create if numero>=0 and else as the second form

import math numero=input (“Enters I number: ?) raiz=math.sqrt (I number) print root

Second form all manual:)
line 1 is to enter a value by keyboard
line 2 I multiply a value entered by x 1,0 to turn into real type.
line 3 - 11 if numero>=0 since if we entered a negative ejm -9 podra not to give no result and if it did not happen to else if it does not meet condition of if and us imprimira Numero incorrec ......
line 4 we declared p is equal to I number
line 5 delaramos and with value 0
line 6 while while i is different that p
line 7 we assigned to value p to i this is only within while
line 8 does not suck is much to write to if that reasons!
there are many ways to if that we can improve example that of multplicar *1.0 I hope that I serve do not let give to them him likes to As Programra!

numero=input (“Enters I number: ?) numero=numero*1.0 if numero>=0:
    p=numero
    i=0
    while i! =p:
    i=p
    p= (numero/p+p)/2
    print “Results is: ?, p else:
print “Wrong number?