So I must convert the python on the right to pascal which is on the left. I need
ID: 3812741 • Letter: S
Question
So I must convert the python on the right to pascal which is on the left. I need to know if i did it correctly or if its wrong how to correct it.
26 repeatsym: begin Modification Begin) getsym; statement until synx semicolon; if sym untilsyn then getsym else error (27) (Modification End condition; 8 end case 353 354 355 356 357 358 359 3G0 361 363 36M 365 366 elif syn REPEAT #MODIFICATION BEGIN while True: getsy statement (tx) semicolon' break if sys 1- UNTIL error (27) Betsy condition(tx) #MODIFICATION END MODIFICATION BEGIN FOR FOR TOI DOWN TO DOExplanation / Answer
Generally the pascal syntax for if else is
if(boolean_expression 1)then
S1 (* Executes when the boolean expression 1 is true *)
else if( boolean_expression 2) then
S2 (* Executes when the boolean expression 2 is true *)
else if( boolean_expression 3) then
S3 (* Executes when the boolean expression 3 is true *)
else
S4; ( * executes when the none of the above condition is true *)
The given code is check the condition until sym = untilsym
Otherwise it fails get error(27)
Python syntax for the if else is
as per the syntax and as per the condition conversion of the code is correct.
Change the code like below
if sym ==”REPEAT”;
While true;
Getsym();
Ststement(lx);
If sym l = “semicolon”;
Elif sym l = “until”
Error(27)
Getsym()
Condition(tx)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.