To run a Python script on your
computer
T.A.
Yang
·
First of all, install a most recent Python package (for example, from https://www.python.org/downloads/).
·
If your download and installation is
successful, you should have a Python folder and associated programs on your
computer.
·
Click the python interpreter (say, Python
3.11 as shown above) to open the interpreter.
·
Visit the Python Tutorial for your version
of Python (for example, https://docs.python.org/3.11/tutorial/)
to learn the Python language.
·
Below is a Python script that prints the
first 100 Fibonacci numbers.
# print first 100 fibonacci
numbers |
(source: http://dcm.uhcl.edu/yue/courses/csci4333/fall2022/notes/EmbeddedSQL/IntroPython.html)
·
Copy the above script into a text editor
(e.g., Notepad++ on Windows) and save it as a normal text file fib100.py.
·
To run the script, open a Command Prompt and use the command python to run the script. (NOTE: It is
assumed that the script is saved in the folder c:\csci4333dir. If you have
saved your script in a different location, use that specific location to invoke
that script.)