7/19 I Know Kung Fu


#1

I don't know Kung Fu.

Before we try any fancy importing, let's see what Python already knows about square roots. On line 3 in the editor, ask Python to

def sqrt(n):
return n ** 0.5
print sqrt(25)

"""My answer equals 5, but I keep getting an error messages that displays 'Oops, try again. Did you try to print sqrt(25) in your code?' I can't believe nobody had trouble with this exercise. Somebody please help?"""


#2

def sprt():
print sqrt(25)

This worked for me and let me pass to the next level....


#3

You dont need to def sprt(): considering its sqrt not sprt
also you are supposed to get an error because python doesnt know sqrts which is what you will be teaching it in the next few lessons

all you need to put for code is

print sqrt(25)


#4

that really do much pretty fine but there is another common way and that way import sqrt from math module it is like import something from stored functions in python math module
now this works for me all way in any python version but once type it here doesn't work!!!!
don't know why code should looks like:
from math import sqrt
print sqrt(number)
any advice??!


#5

I wrote:

ediehunieiubcdbbi

I passed


#6

I passed
你只需要在第三行写 print sqrt(25)
这里有bug啊 这个程序一定要是错的 如果 你让它不报错的话 就不会通过
可惜 没有人看得懂中文哈哈哈


#8

I keep getting an error message, saying that sqrt is not defined.


#9

Never mind what I said. -.-


#10

regardless what I'm doing I cannot pass:-(

I have done
import math
print math.sqrt(25)

OR:
from math import sqrt
print sqrt(25)

It must be something wrong with the "machine checker" for such a simple task!


#11

don't try to import anything , they tell you to print sqrt(25) nothing else ( so you see an error then in next exercise you will try to fix the error by importing functions )
the next exercise Generic Imports
Did you see that? Python said: "NameError: name 'sqrt' is not defined." Python doesn't know what square roots are—yet.


#12

No matter what I do, My session is completed with an error in the console saying,
"Traceback (most recent call last):
File "python", line 3, in
NameError: name 'sqrt' is not defined"

Please suggest!


#13

I get the same thing!!!! And my code is the same as yours, except I've defined the sqrt by saying """Returns the square root of a number""".


#14

Okay, now this sucks!!!


#15

import math
print sqrt(25)