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
cd 'Python2Pseudocode_dir'
pip install -e .
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]]))