12 — Convert: turn Python into NME
nme convert goes the other way: it rewrites safe Python patterns into the
level and language you choose. Lines it cannot convert safely stay Python.
Steps
Create
old.pywith a few familiar lines:print("hi") name = input("Name: ") if name: print("hi", name)Convert it to English sentence syntax:
nme convert old.py --level sentence --language en -o easy.nmeThe result keeps the
if(Python) but rewrites what it can:
run it →show "hi" ask name "Name: " if name: print("hi", name)The Korean command uses
변환; beginner syntax keeps the quotes, as the converter always does:nme 변환 old.py --level beginner --language ko -o easy.ko.nmeThe result:
run it →말해 "hi" 물어봐 name, "Name: " if name: print("hi", name)Check and run the converted programs:
nme c easy nme run easyThe converter never guesses: anything that could change the meaning stays ordinary Python.
Try it yourself
Add a for i in range(3): print(i) line to old.py and convert again at
--level beginner. The loop becomes 3 times: say i — but only after you
read the result.
What you learned
nme convertrewrites safeprint,input, and simple patterns.--level sentence|beginner|advancedand--language en|kopick the target.nme 변환is the Korean command.- Everything uncertain stays Python — no lossy guesses.