Translate a C program to Pep8

This is a discussion on Translate a C program to Pep8 within the Tech Board forums, part of the Community Boards category; How would i go about converting a simple guessing game i made in C into a pep8 program?...

  1. #1
    Registered User
    Join Date
    Sep 2012
    Posts
    23

    Talking Translate a C program to Pep8

    How would i go about converting a simple guessing game i made in C into a pep8 program?

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,289
    a google search for PEP8 came up with two major results for the definition of PEP8

    1. A code style standard for python.
    2. A CPU (possibly not a real one?) used in several assembly language courses.

    to which one are you referring?

  3. #3
    Registered User
    Join Date
    Sep 2012
    Posts
    23
    the first one

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    2,289
    I would use a C compiler, if available and instruct it to output assembly code instead of object or executable code.

    failing that, I would break the program down into a set of very basic operations and implement each one, along with the logic that goes with it. do you know PEP/8 assembly language? if not, you'll likely need to learn it first, unless you have access to a C compiler that can generate PEP/8 code.

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,397
    Eh, since by "pep8" you mean "A code style standard for python", then the right question to ask is:
    How would i go about converting a simple guessing game i made in C into a Python program?

    Styling your Python code according to the guidelines in PEP-8 is secondary to the task at hand.

    Anyway, the answer is: you translate what the C program does into Python. This does not necessarily mean line by line conversion, and sometimes it is easier to just write the Python program from scratch then use the C program to help verify the Python program's correctness.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,289
    wow, I must have been really tired when I last posted. I gave the answer as if the OP had said "the second one," and for that I apologize.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. translate int_32 to 8-bit
    By quantt in forum C Programming
    Replies: 8
    Last Post: 01-26-2009, 03:47 PM
  2. Please translate
    By Ron in forum C Programming
    Replies: 24
    Last Post: 07-31-2008, 06:37 AM
  3. translate
    By limitmaster in forum C++ Programming
    Replies: 9
    Last Post: 08-13-2006, 01:55 AM
  4. just translate !
    By black in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 07-03-2002, 02:14 AM
  5. Can anyone translate this into C? from C++?
    By Wizard_D in forum C Programming
    Replies: 2
    Last Post: 12-19-2001, 01:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21