python怎么导入数学模块_Python不会导入数学模块。它正在获取一个甚至不在那里的文件。我该怎么办?...

# quadratic.py

# A program that computes the real roots fo a quadratic equation.

# Illustrates the use of the math library

# Note: This program crashes if the equation has no real roots

import math # math makes the library available

def main():

print "This program finds the real solutions to a quadratic"

print

a, b, c = input("Please enter the coefficients (a, b, c): ")

discRoot = math.sqrt(b * b - 4 * a * c)

root1 = (-b +discRoot) / (2 * a)

root2 = (-b +discRoot) / (2 * a)

print

print "The solutions are: ", root1 , root2

main()

她是我得到的错误:Macintosh-7:python andrewmetersky$ python quadratic.py

The answer to my homework question: what is i+x+j =

Traceback (most recent call last):

File "quadratic.py", line 6, in

import math # math makes the library available

File "/Users/andrewmetersky/Desktop/Programming/Python/math.py", line 5, in

NameError: name 'jp' is not defined

问题是,数学.py在那个地方连个文件都没有。是的,但我删除了它,因为我认为Python是在尝试获取它,而不是数学模块。有一个文件叫做数学.pyc在那个位置…是模块吗?为什么它不把它拿来呢。在

谢谢

另外,如何使我刚刚粘贴的部分显示为带有堆栈溢出的代码,而不必为每行按4x空格。在

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值