locked
convert code to pseuocode RRS feed

  • Question

  • import datetime
    from datetime import timedelta
    import datetime
    import time
    from datetime import datetime
    from datetime import timedelta
    import glob
    fout6=open('number.txt')
    X=fout6.readline()
    nA=int(X[34:])
    Y=fout6.readline()
    nB=int(Y[34:])
    Thursday, May 24, 2018 1:13 PM

All replies

  • is this pseuocode
    Thursday, May 24, 2018 1:14 PM
  • Pseudocode is any English-like format that describes how to solve a problem without referring to language-specific details so just about everything is pseudocode. But there are several lines in there that indicate it came directly from code.

    • from … import => clearly a language thing, not pseudocode
    • import => ditto
    • open => open the file
    • fout6.readline => language specific "read the line from the file"

    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, May 24, 2018 2:15 PM
  • Pseudocode is any English-like format that describes how to solve a problem without referring to language-specific details so just about everything is pseudocode. But there are several lines in there that indicate it came directly from code.


    Hi Michael, are other natural languages as well allowed or is it an exclusive right given to English

    Or maybe you mean Dutch is allowed but Chinese not.

    :-)


    Success
    Cor

    Thursday, May 24, 2018 4:36 PM
    • Edited by Viorel_MVP Thursday, May 24, 2018 8:01 PM
    Thursday, May 24, 2018 7:55 PM
  • This is Python code.  It reads two lines from the file called "number.txt".  It then assumes there is a number starting at column 34 on both lines, and extracts those numbers into nA and nB.

    "import" in Python is quite similar to "using" in C#, but this code isn't using any of the imports.


    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Friday, May 25, 2018 6:24 AM