Scientific Computing
Thonny is a simple Python IDE (integrated development environment) that we will use to create programs written in Python and run them. Complete the following steps to install Thonny on your computer.
Click on Thonny’s homepage. In the top right box, select your operating system - Windows, Mac, or Linux - which will download the appropriate installer.
Double click the downloaded .pkg file. Click ‘Continue’ a few times and agree to the terms of service. When prompted, choose the default option ‘Install for all users of this computer’. You will need to type in the password you use to log into your computer. Click ‘Continue’ until the installation finishes.
You can now access Thonny from Spotlight. To launch it, click the magnifying glass on the top right corner of your screen and start to type “Thonny”. Double click the application and select ‘Let’s Go!’
We will use this application often, so it might help for you to save it in the Dock for easy access later. Right click on the Thonny icon, select Options –> Keep in Dock.
Double click on the downloaded .exe file. Click ‘Next’. When prompted, you may want to choose to create a desktop icon so that you can access it easily. The remaining default options are fine, so you can click ‘Next’ a few more times until it finishes.
You can now launch Thonny by double clicking the Thonny icon from your desktop. If you didn’t save it as an icon, you can also search for Thonny from the start menu by typing “Thonny”.
In your terminal, run sudo apt-get install thonny
. Type y
to continue.
You’re now ready to write a program. Open Thonny and follow these steps:
cs100
(yes, no spaces!). Inside that folder create three folders: ch1
, ch2
, ch3
, ch4
, ch5
, ch6
, hw
. You will be saving today’s work (and all work from chapter 1) in ch1
. Work done from chapter 2 of the textbook will be saved in ch2 and so on.print("Hello world!")
hello.py
in the ch1
folder you created in Step 1.Hello world!
it reads Hello, Dr. Guarnera!
Hello world
, add the following lines:
print(" *")
print(" ***")
print(" *****")
print(" *******")
Congratulations, you just wrote your first Python program! 😊
Make sure you saved your work and that it runs without errors. Submit your hello.py
file to Moodle.