Skip to content

Latest commit

 

History

History
65 lines (64 loc) · 3.95 KB

README.md

File metadata and controls

65 lines (64 loc) · 3.95 KB

Beginner's Python

Write a Python Poem

  1. Go to the online Python tester and write your poem.
  2. Follow the prompts and see your poem revealed!
  3. Go to the editor to see the code. How does it work?

Python Guessing Game

For this project, you have the finished code available to download. We will download the Python file and learn how to run the program using the command line on your computer. This requires that Python is installed on your computer.

Running the Program in the Command Line

  1. Download the file guessinggame.py to your computer.
  2. Open the command line on your computer. For Mac Users, this program is called Terminal. For PC users, this program is called Command Prompt and can be found under Accessories. What is the command line?
  3. Once the command line is open, we will check to see if Python is installed on your computer. Type Python and press enter. This will either show you the version you have, or tell you it is not installed. You can install Python here. (It's free.)
  4. To go back to the command line type:

    exit()
  5. Once Python is installed, you can run the program you downloaded using the command line.

  6. python guessinggame.py
    This will look different, depending on where the file is saved. For example, if you save it on your desktop, it would look like this:

    python desktop/guessinggame.py
  7. This should launch the program in the Command Line.
  8. Enter guesses until you guess the correct answer.

Running the Program in the Browser
  1. Open a browser-based Python Interpreter such as:
  2. Copy and paste the code into the interpreter.
  3. Run the code and check for errors. 8 Most Common Python Errors
  4. Fix the errors. (Don't be afraid to Google.)

**Need help? Go to this editor with the code already loaded.


Editing the Program

  1. Open the file in a text editor, such as Sublime Text.
  2. Change the range of numbers to between 1 and 10.
  3. Save the file and run the program in the Command Line again.
  4. In your text editor, change the text slightly and save.
  5. Test your changes in the Command Line.

More Practice


Fix a Broken Program
  1. Download the Broken Age Checker File.
  2. Run it in the Command Line or copy and paste it into an online Python tester.
  3. Run it once with a number more than 18 and once with a number less than 18.
  4. Look at the code form the Guessing Game and compare. Why is the Age Checker not working?
Create a New Progam
  • Open a new file and create your own program. Use an if and else to give a response based on a user input.