0% found this document useful (0 votes)
19 views2 pages

Tips To Remember When You Write Pseudocodes and Python Codes

Uploaded by

peirisvenuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views2 pages

Tips To Remember When You Write Pseudocodes and Python Codes

Uploaded by

peirisvenuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Tips to remember when you write pseudocodes

 All keywords must write in full capital


 If you want to give a input command first you need to give a message to the user
by using the SEND keyword (message must include within inverted commas), to
accept the user input use RECEIVE keyword and make sure to specify the data
type of the variable
Ex: SEND “Enter the height (between 1 and 100): “ TO DISPLAY
RECEIVE height FROM (INTEGER) KEYBOARD

Data type
Variable name

 In if conditions after you specify the condition THEN keyword must be available
and when the if condition ends END IF must include.
Ex:
IF (height >= 1 AND height <= 100) THEN THEN keyword

heightChk = FALSE
END IF END IF must include when
the if condition ends

 For while loops DO must use after you specify the condition and to end the
while loop END WHILE must include
Ex:
WHILE heightChk DO
SEND “Enter the height (between 1 and 100): “ TO DISPLAY
RECEIVE height FROM (INTEGER) KEYBOARD
IF (height >= 1 AND height <= 100) THEN
heightChk = FALSE
END IF
END WHILE

 If you assign a value for a variable SET keyword must use


Examples:
SET area TO 0.5 * base * height
 When you intialise a value for a variable also you need to use the SET keyword
Ex: SET base TO 50
 Proper indentation must use for every block of codes.
 If you include comments type # and then write the comment

Tips to remember when you write python codes


 In python all the keywords should be simple
 If you specify a string value always it must include within quotes
Ex: Username=’gerb456’
 After every loop condition or if condition colon (:) must type
Indentation must be correct
 For inputs according to the value you enter data type must specify
 According to the given explanation you should be able find what are the variables
you should use
 If they have given a pseudocode or a flowchart and asking to write the python
code you have to use the exact variable names they have given and have to follow
the given algorithm
 If you include comments type # and then type the comment

You might also like