Pseudo Code vs Python

Example 1: Finding the Maximum of Two Numbers

Pseudo Code

Start
  Input num1
  Input num2
  If num1 > num2
    Display num1
  Else
    Display num2
  End If
Stop

Python

num1 = int(input("Enter the first number: "))
num2 = int(input("Enter the second number: ")

if num1 > num2:
    print(num1)
else:
    print(num2)

Example 2: Calculating the Sum of Integers from 1 to N

Pseudo Code

Start
  Input N
  sum = 0
  For i from 1 to N
    sum = sum + i
  End For
  Display sum
Stop

Python

N = int(input("Enter a number: "))
sum = 0

for i in range(1, N + 1):
    sum += i

print(sum)