โ† Back to all tools

๐Ÿ”„ Python โ†” Pseudocode

Convert between Python and WJEC-style pseudocode. Uses actual Appendix B conventions from the specification.

Designed with the WJEC specification in mind โ€” Appendix B
CS GCSE ยง1.4 / Appendix B
๐Ÿ”„

Converter

๐Ÿ Python

โ†’
โ†

๐Ÿ“‹ WJEC Pseudocode

๐Ÿ“–

WJEC Pseudocode Reference (Appendix B)

ConceptPythonWJEC Pseudocode
Outputprint("hello")OUTPUT "hello"
Inputx = input("prompt")x โ† USERINPUT
Assignmentx = 5x โ† 5
Ifif x > 5:IF x > 5 THEN
Elseelse:ELSE
Else ifelif x > 3:ELSEIF x > 3 THEN
End if(indentation)ENDIF
For loopfor i in range(1,11):FOR i โ† 1 TO 10
End for(indentation)ENDFOR
Whilewhile x > 0:WHILE x > 0
End while(indentation)ENDWHILE
Function defdef add(a, b):FUNCTION add(a, b)
Returnreturn resultRETURN result
End function(indentation)ENDFUNCTION
Array accessarr[0]arr[0]
Lengthlen(arr)LENGTH(arr)
String concat"hi" + name"hi" & name
And / Or / Notand / or / notAND / OR / NOT
Int conversionint(x)INT(x)
String conversionstr(x)STRING(x)
Open file readf = open("f.txt","r")OPENREAD("f.txt")
Open file writef = open("f.txt","w")OPENWRITE("f.txt")
Read lineline = f.readline()line โ† READLINE()
Write linef.write(data)WRITELINE(data)
Close filef.close()CLOSEFILE()