Unit:8 Pseudocode and Python Flashcards
In pseudo code how do u assign a variable?
Colour <— “red”
In python how do u assign a variable?
Colour = “red”
In pseudo code how do u output/input?
INPUT Colour
OUTPUT “The colour is “, Colour
In python how do u output/input?
Colour = input( )
Print (“The colour is”, colour)
In pseudo code how do u declare constants?
CONSTANT Colour <— “yellow”
In python how do u declare constants?
Colour_const. = “yellow”
In pseudo code what is the data type for text ?
Text or alphanumeric
In python what is the data type for text ?
String
In pseudo code what is the data type for whole numbers?
Integer
In python what is the data type for whole numbers?
Integer
In pseudo code what is the data type for a decimal?
Real
In python what is the data type for a decimal?
Float
In pseudo code what is the data type for true or false?
Boolean
In python what is the data type for true or false?
Boolean
How do you add numbers?
10 + 5
How do you subtract numbers?
10 - 2
How do you multiply numbers?
10 * 2
How do you divide numbers?
10 / 2
How do you divide 2 numbers ignoring the decimals?
DIV (11, 2)
It gives 5
How do you divide 2 numbers only showing the decimals?
MOD (11,2)
It gives 1
How do you show powers of numbers?
10^2
In python how do you write ‘not equal to’?
!=
How would you use an IF statement in pseudo code?
IF …………… THEN
…………………….
ENDIF
How would you use an IF statement in python?
if ………… :
………………….