A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 5 years ago

Is there a way to repair an error in a program without rewriting the entire program?

  • This Question is Closed
  1. Chris
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

  2. julie
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    hey, you may be confusing the interactive interpreter (write successive commands in a prompt) with running a python text file. the command line style python interpreter is great for testing out language constructs quickly. however, once you move on to more complex programs you'll often want to create a text file that holds your python commands. the convention in python is to create a text file with the extension ".py", e.g. "prime.py" that holds the same commands you type into your interpreter. from a command line, you can then run the program with "python <filename>". That way if there are errors, you only have to change the line in your text file that caused the error - not type the whole thing again. take a look at this if you have more questions: http://docs.python.org/faq/windows.html#how-do-i-run-a-python-program-under-windows

  3. Chris
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    what julie said

  4. Chris
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    if you're on unix, then you can do > python ps1.py

  5. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    In addition, on unix, you can add a "shebang" line like this to the beginning of your program: #! /usr/bin/python Then you can make your program executable with "chmod +x ps1.py", and then execute it directly with ./ps1.py. This method is used by most system maintenance scripts. On Windows you can make an association with the .py file extension to make Python open all such files. Windows would ignore the shebang line, resulting in one file that might work on Unix/Linux, Windows, and OS X.

  6. anonymous
    • 5 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    Thanks Julie and others, That was exactly the confusion I had and your help solves the problem.

  7. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.