Pseudocode, Logic Errors, and Flowcharts.
(a) 12.50
(b) 35.00 (Default case)
if destination == "UK" then cost = 5.00 elseif destination == "EU" then cost = 12.50 elseif destination == "US" then cost = 20.00 else cost = 35.00 endif
for i = 2 to 10
print(i)
i = i + 1
Q2: 50 > 50 is False. Discount = 0. Output = 0.
Q3: The loop increments `i` automatically. Adding `i = i + 1` means it increases by 2 each time, skipping numbers.
if age > 17 (Logic error). Correct it.
while password != "Secret" but no input inside
loop. Fix it.
if colour == "Red" OR "Blue". Why is this wrong?
"Blue" as a separate "True" statement. It doesn't know you
mean colour == "Blue".
Q4: if age >= 17 (or > 16).
Q5: Add password = input(...) inside the loop.
Q6: "Blue" evaluates to True on its own. Correct:
if colour == "Red" OR colour == "Blue".
price = input("Price")
money = input("Inserted")
change = money - price
if change < 0 then
print("Not enough money")
else
print(change)
endif
total variable starting at 0.
total = 0
for i = 1 to 5
score = input("Enter score")
total = total + score
next i
average = total / 5
print(average)
students (size 30) for "Sarah".
found = False
for i = 0 to 29
if students[i] == "Sarah" then
print("Found")
found = True
break (or exit loop)
endif
next i
if found == False then
print("Not Found")
endif