# Popcorn Hack 2
nums= []
x=12
for i in range(12):
user = int(input("Enter a number"))
if user % 3==0:
nums.append(user)
else:
print("not divisible by 3")
print("The only numbers divisble by 3 that you entered are:")
print(nums)
not divisible by 3
The only numbers divisble by 3 that you entered are:
[3, 3, 3, 3]
# Popcorn Hack 3
numbers = [1, 2, "three", 4, 0, "five"]
for item in numbers:
try:
result = 10 / item
print(result)
except ZeroDivisionError:
print("ZeroDivisionError")
except TypeError:
print("TypeError")
10.0
5.0
TypeError
2.5
ZeroDivisionError
TypeError