translating | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

translating

Hi guys please help me on this! how can i translate it from pascal to python3?! program Writing_numbers; const d1: array[1..9] of string=('yek','do','se','chahar','panj','shesh','haft','hasht' ,'noh') d2: array[1..9] of string=('dah','bist','si','chehel','panjah','shast','haftad'. 'hashtad','navad') d3: array[1..9] of string=('sad','devist','sisad','chaharsad'.'pansad','sheshsad', 'haftsad','hashtsad','nohsad') d4: array[11..19] of string=('yazdah','davazdah','sizdah','chahardah','panzdah' ,'shanzdah','hefdah','hejdah','noozdah') var n: Integer; begin ReadLn(n) if n > 999 then begin if n div 1000 > 1 then Write(d1[n div 1000], ' '); Write('hezar') n:= n mod 100; if n = 0 then Exit; Write(' o ') end; if n > 99 then begin Write(d3[n div 100]); n := n mod 100; if n = 0 then Exit; Write(' o '); end; if(n > 10) and (n < 20)then Write(d4[n]) else begin if n > 9 then begin Write(d2[n div 10]); n := n mod 10; if n > 0 then Exit; Write(' o ') end; Write([d1[n]); end; end.

25th Oct 2018, 5:21 PM
hossein kian
hossein kian - avatar
1 Answer
+ 1
dude... just try jt yourself go step by step and translate. oh, and why would you need it in python 3 format anyway? just use what you already have
29th Oct 2018, 9:21 PM
inxanedev!
inxanedev! - avatar