Hi there and welcome!

import maths;
decibel = math.log10 (17.0);
angle = 1.5;
height = math.sin(angle);
print height;

Traceback (most recent call last):
 File "C:/Python27/test", line 1, in <module>
   import maths;
ImportError: No module named maths

Oops! It's a nice error report, though! Python tried to locate a module called 'maths' and was not able to find it.

What happens if you try:

  import math

N.B. You say 'import maths'--assume that this import succeeded. A few lines later, there's a line 'math.log10(17.0)' which seems to be trying to use something from a module called 'math' not 'maths'.

I don't know what I'm doing wrong?

Computers are so picky.

From what I've read the maths module is supposed to come with the python
installation package.

The 'math' library is a standard library module for quite awhile now. Here's a possibly useful online link, which describes that module:

  https://docs.python.org/2/library/math.html

This is just more documentation support, in addition to the book you are reading.

I'm using a windows 8 operating system
python 2.7.8
please help?

One other issue I might point out. The semicolon at the end of the line (statement) is a feature of other programming languages with which you may be familiar (C, Java, Perl), but it is not necessary and, in fact, discouraged in Python.

So, rid yourself of the semicolons and enjoy the benefits of a trivially cleaner syntax.

Enjoy!

-Martin

P.S. Thanks for your clear question and letting us know your OS and Python version, as well.

--
Martin A. Brown
http://linux-ip.net/
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to