#Python Pop Quiz 🐍❓
How do you get the following code to work? It should take in a number, return the square root and print it.
Answer? Show more
@driscollis sq_root is, for historical reasons*, called sqrt.
Alternatively, skip the import and just return number ** 0.5.
For a side quiz, why doesn't number ** 1/2 work?
*almost always the worst reason for anything.
@peterdrake @driscollis `64**(1/2)` works, but `64**1/2` returns `32.0`, because of operator precedence.
QOTO: Question Others to Teach Ourselves An inclusive, Academic Freedom, instance All cultures welcome. Hate speech and harassment strictly forbidden.
Answer?
@peterdrake @driscollis `64**(1/2)` works, but `64**1/2` returns `32.0`, because of operator precedence.