Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
Downloading and Installing Python Instructions¶
Below are the instructions on how to download and install python on your local computer so that you can create your own programs and run them through an Integrated Development Environment (IDE) or a terminal.
Python Shell Instructions:¶
Download Python for your operating system from the Python website: https://www.python.org/downloads/. Python 3 is the version of Python you have used in this book.
Open the file you downloaded to start the installation process.
Once the installation is complete you should see an application called “IDLE” on your computer. There are two ways to run Python:
Way #1: You can use the Python shell where you can directly run commands one at a time. Below is an example of what the IDLE shell looks like.
Way #2: You can also write multiple lines of Python in a file and then run all those lines at once. This is similar to what you’ve seen in this book. Use File > New File to start a new Python file from scratch, or use File > Open to open an existing file. Run the file with Run > Run Module or F5.
JES is an IDE that makes it easy to get started with Python and allows you to write programs to change pictures and sounds. JES is especially useful when you need help in identifying errors in your code or need to organize your code better.
Download the latest version of JES for your operating system from this link: http://coweb.cc.gatech.edu/mediaComp-teach#Python
After downloading, click on the JES icon to start the application. Below is a sample function and its output.
Make sure that you save the code that you write into a Python file on your computer. Before running a function make sure you load the program and then call the function in the output box (bottom black part).
Beyond this particular ebook, numerous other resources exist to help you expand your Python knowledge into advanced concepts. Here are some of our recommendations:
*How To Think Like A Computer Scientist - HIGHLY RECOMMENDED. FREE. This is another runestone ebook that covers advanced concepts such as debugging, object oriented programming, and recursion to just name a few. Perfect transition from this book.
Introduction to Computing and Programming in Python - Mark Guzdial & Barbara Ericson. If you want a better foundation in Python and want to get acquainted with JES this book is for you. It focuses on a multi-media approach to help you better get acquainted with the language in a highly applicable environment.
Python Programming in Context * - Bradley N. Miller
Python For Computational Science and Engineering - Hans Fangohr FREE.
Python Cookbook - Brian K. Jones & David M. Beazley
A strength of Python compared to other languages is the amount of modules and libraries it contains. The modules and libraries offer extensive code that you can build off of to do cool things! By simply importing these modules you can take advantage of the code others have written to create interactive programs.
Some examples of popular Python libraries are Pygame (used to create multimedia games), Tkinter (used to create friendly user interfaces), and Beautiful Soup (used for easy web scraping). Numerous modules exist online, complete with extensive tutorials and videos, so it is very easy to incorporate a module into your own code.
Small Scale Projects¶
By this point in the textbook, you have probably gone through numerous small exercises and basic code problems. It is now time to put your fundamentals to the test and work on a larger project with different functions and parts. Small scale projects are a great way to demonstrate what you know.
Here is a list of sample projects:
Make a calculator Using Tkinter with a GUI (Graphical User Interface)
Create a multi-media project in JES With animation (hint: import time)
Read from CSV files and graph the data using the following libraries: https://www.dataquest.io/blog/python-data-visualization-libraries/
Create a GUI that allows you to manipulate a picture multiple ways (grayscale, crop, horizontal flip, etc)
Develop a tic-tac-toe game using Pygame / Tkinter.
Use the data visualization libraries above to graph two stocks simultaneously. (Hint: Create excel tables to store the date and price of each stock and then use the Python library to import and graph the data)
Application And Beyond¶
Computer science is like having a puzzle to solve, but without having all of the puzzle pieces, most of which you have to create yourself. The real-world application of computer science is endless. It can change the way you think, it can make processes easier and more efficient, and it has rapidly changed everyday technology.
Businesses need to process, store, and organize a huge amount of data. Today, large scale data warehouses hold huge amounts of company data, which is used for data mining, analytics reporting, and integration. How is this all achieved? Programs are used to process data and turn it into information that businesses can interpret and use to make decisions.
Another important application of computing is in the supply chain. The supply chain is the sequence of processes involved in the production and distribution of a commodity. Companies such as UPS and Coke deal with supply chain issues on a major scale. UPS needs to deliver packages and Coke wants to get their products onto shelves as quickly and efficiently as possible. Computer scientists have developed algorithms to make the process as efficient and fast as possible. For example, Dijkstra’s algorithm, finds the shortest path between two points A and B.
Algorithms are processes or sets of rules to be followed in calculations or other problem-solving operations, and are the fundamental ways computers function and perform tasks. There are now algorithms that predict growth and sales for a company, algorithms that are able to determine cell growth, and much, much more. How do you apply an algorithm to something as random as cell growth you ask? Well the algorithms developed thus far are based on stochastic simulation, or random models that have a probability distribution or pattern. You might try to say, simulate the chemical reactions associated with cell growth and measure the time-dependent reaction rates, as well as the growth and division of the cells over time.
Even today, the use of algorithms in sports analytics is exploding. For example, the use of John Hollinger’s formula to determine an NBA player’s efficiency on the court incorporates many different types of stats and player performance has inspired teams around the league to start investing in their analytics department. Who are these “analysts” you ask? They are no other than your coders, developers, and computer scientists who look at different variables in the basketball landscape and determine what the relationships between these variables are.