Nov-05-2016, 03:20 PM
I'm learning computer programming with John Zelle's Python Programming: An Introduction to Computer Science. In the first chapter, he explains how to make a module and import it. Following his instructions, I have no difficulties making a module, but I can't import it. When I run 'import', I receive the following error message:
I use IDLE Python 3.5.2 running on Windows 7.
Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import chaos File "C:\Users\xxx\AppData\Local\Programs\Python\Python35-32\chaos.py", line 1 Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 ^ SyntaxError: invalid syntaxThis is the program I saved:
# File: chaos.py # A simple program illustrating chaotic behavior. def main(): print("This program illustrates a chaotic function") x = eval(input("Enter a number between 0 and 1: ")) for i in range(10): x = 3.9 * x * (1 -x) print(x) main()I don't know the cause of the error. What could it be?
I use IDLE Python 3.5.2 running on Windows 7.