Skip to main content

Lec 13 Errors and Modules

Assignment Updates

Stuff due soon:

  • HW5 due April 12th (next Wednesday)
  • Participation 7 due Thursday
  • Quiz 8 due Thursday
  • Lab on Friday

Slides

Activities

Identify the Error

Activity: Categorize and fix the errors in the code below. There may be no error. If there is an error, what is it and how can you fix it?

Block_1
# Goal: Get 33Hello
x = 33
y = "Hello"
print(x + y)
Block_2
# Goal Add the 2 entered numbers together: 12 + 13 = 25
x = input("Enter a number: ")
y = input("Enter another number: ")
print(x + y)
Block_3
# Goal: Sum 1x and 2x and print the total
1x = 33
2x = 0
total = 1x + 2x
print(total)
Block_4
# Goal: Print the product of the 2 numbers entered
num1 = input("Enter a number: ")
num2 = input("Enter another number: ")
product = int(num1) * int(num2)
print(product)

Using Documentation

Great resources include:

Try to find the answer to the activity in the slides using these resources (or others)