Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Latest commit

 

History

History
61 lines (46 loc) · 1.05 KB

ReadME.MD

File metadata and controls

61 lines (46 loc) · 1.05 KB

Python2Pseudocode

Python2Pseudocode - is a cli-tool which converts python code to pseudocode for code2flow site.

num_list = [1,2,3]
num_sum = 0
for i in num_list:
    num_sum += i
print(num_sum/(len(num_list)-1))

Converts to

begin;

/num_list,num_sum,i/;

num_list = \[1,2,3\];

num_sum = 0;


while(i in num_list){
num_sum += i;

}

/ num_sum÷(len(num_list)-1) /;


end;

By code2flow converts to

Installation

cd 'Python2Pseudocode_dir' 
pip install -e .

Usage

To get pseudocode of file run 'portable_build.py' or run it:

py2ps file_path

If you want to convert functions(in current file) to procedures run it:

py2ps file_path procedural

This option is experemental. At the moment, it works with code like this:

def get_avr_arithmetic(num_list):
    num_sum = 0

    for i in num_list:
        num_sum += i

    return num_sum/(len(num_list)-1)
print(get_avr_arithmetic([[1,2,3]]))