Coder Social home page Coder Social logo

pythonguessinggame's Introduction

PythonGuessingGame

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 Broswer
  1. Open an in the browser Python Interpter 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.)

Editing the Progam

  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.

pythonguessinggame's People

Contributors

cneymoss avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.