How to enter the root number for python
Most people do not understand the knowledge of this article "python how to enter the root", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to enter the root of python" article.
The first method
To use the math module, you need to call it before use, as follows
The second method
Use the built-in function pow (), as follows
The third method
Use mathematical expressions
The python root function def panduan (x): # first determines which two integers a given number is between. For i in range: if xi*i: return i; elif x==i*i: # if it can be obtained directly, it will be output directly. Print (I) return-1; elif x
< 0: #若为负数则提示。 print("请输入大于0的数字!") return -1def bijin(list): #用两个数字通过除二逐渐逼近这个结果 t = (list[0]+list[1])/2 if x >List: list [0] = t else: list [1] = tx = float (input ("Please enter:") y = panduan (x) if y! =-1: list = [ythesis 1] while list [0] * 10000000000000 = 0: # here you can control the number of places after the decimal place. Replaced by 10 places I can control decimal places bijin (list) print (list [0]) above is about "python how to enter the root" the content of this article, I believe we all have a certain understanding, I hope the editor to share the content to help you, if you want to learn more related knowledge content, please follow the industry information channel.