Created
October 24, 2017 14:49
-
-
Save franciscojsc/479d9ae92b3536cefe258be86f9f6943 to your computer and use it in GitHub Desktop.
CALCULAR RAIZ QUADRADA E CÚBICA EM PYTHON
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| raiz = float(input('Entre com o valor: ')) | |
| raizQ = raiz ** (1/2) | |
| raizC = raiz ** (1/3) | |
| print('A raiz quadrada foi {:.2f} e a raiz cúbica foi {:.2f}'.format(raizQ, raizC)) |
Obrigada!
Só para deixar mais visível.
seja
resultado = y ** x
Coloque
print(f"O resultado da {x}√{y} = {resultado:.2f}")
Valeu, ajudou muito!!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para calcular qualquer tipo de raiz (quadrada, cúbica e outras)
raiz = float(input('Entre com o valor: '))
x = int(input("Qual raiz você quer calcular?\n (para quadrada insira o n 2, cúbica n 3...) "))
raizx = raiz ** (1/x)
print("A raiz deste número é", raizx)