CMU 15-112: Fundamentals of Programming and Computer Science
Class Notes: Getting Started


  1. Running Python
  2. Hello World in Python
  3. Python Comments

  1. Running Python
    Python is our programming language for the semester, so let's start by writing a very simple test program in it.

    If you have used Python before and have a Python editor installed (such as Spyder or Idle) that you are comfortable using, then go ahead and skip ahead to Hello World in Python. If you don't, then continue below to install our editor of choice.

    If you don't have Python installed, then we recommend you install Thonny. Take some time now to go ahead and install Thonny on your computer.

  2. Hello World in Python
    Now let's look at how to run a simple Python program in Thonny.
    • Run Thonny
    • Click on the file menu and click on New - this will create a new window
    • Write the following text in this new window:
      print("Hello World!!")
    • Press F5 to run the program, it will ask you to save the file, Click on yes and then save the file in a folder inside the Documents folder. Make sure you give your file an appropriate name and a .py extension.
    • When you are done, you should see "Hello World!" printed.

  3. Python Comments
    print("Hello World!") # This is a comment # print "What will this line do?"