Python - Pseudocode Answer Key
Python - Pseudocode Answer Key
Pseudocode/Python code programs:
1.
Python:
i=1
while i <= 10:
print (i)
i +=1
Pseudocode:
Start
i=1
while i is 10 or less:
output i
Add 1 to i
End
2.
Python:
Pseudocode:
Start
FOR i from 1 to 10:
OUTPUT i
End
3.
Python:
i=2
while i <= 20:
print(i)
i += 2
Pseudocode:
Start
Set i to 2
Repeat while i is less than or equal to 20:
Output i
Add 2 to i
End
4.
Python:
Pseudocode:
Start
Input num
Input r
For i from 1 to r:
Output num * i in format: num * i = result
End
5.
Python:
Pseoudocode:
Start
Input num
If num mod 2 = 0 then
Output "even"
Else
Output "odd"
End
6.
Python:
Pseudocode:
Start
Input age
If age is 18 or more then
Output "You are eligible to vote"
Else
Output "You are not eligible to vote"
End
7.
Python:
Pseudocode:
Start
Main:
Input length
Input width
Input height
End
8.
Python:
i = 10
while i >= 1:
print(i)
i -= 1
Pseudocode:
Start
Set i to 10
While i is greater than or equal to 1:
Output i
Subtract 1 from i
End
9.
Python:
Pseudocode:
Start
For num from 1200 to 2200:
If num mod 7 = 0 and num mod 5 = 0 then
Output num
End
10.
Python:
print("Area:", area)
print("Perimeter:", perimeter)
Pseudocode:
Start
Input length
Input width
Output area
Output perimeter
End