Login
📚 Python for Introductory Statistics: Lab Workbook
Chapters ▾

3.3 Syntax Errors

Watch demo video

Lab 3.3.1

Identify the error

b=2
 c=4
b/c

view answer

Lab 3.3.2

Identify the error in the code below:

a = 1
b = 2
if a > b
 print("a is bigger than b")
elif a == b:
 print("equal")
else:
 print("a is smaller than b")

view answer

Lab 3.3.3

Identify the error

a = 1
b = 2
if a > b:
 print("a is bigger than b")
elif a = b:
 print("equal)
else:
 print("a is smaller than b")

view answer

Lab 3.3.4

Identify the error

a = 1
b = 2
if a > b:
 print("a is bigger than b")
elif a == b:
 print("equal)
else:
 print("a is smaller than b")

view answer

Adapted from Python for Introductory Statistics: Student's Lab Workbook, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.