print(1/0)
# ZeroDivisionError: division by zero
print(a)
# NameError: name 'a' is not defined
list1 = [1,2,3]
print(list1[3])
# IndexError: list index out of range
tup = (1,2)
tup[0] = 3
# TypeError: 'tuple' object does not support item assignment
dict1 = {'a':1}
print(dict1['b'])
# KeyError: 'b'
1
yanyu-xin
2023-02-25来自广东
a = [1, 3, 4]
print(a[5]) # IndexError: list index out of range
print(b) # NameError: name 'b' is not defined
d= {'a':2, 'c':4}
print(d['d']) # KeyError: 'd'
c = 123
print(c[0]) # TypeError: 'int' object is not subscriptable
print(c / 0) # ZeroDivisionError: division by zero
d = 'asfdfd'
print(d + 3) # TypeError: can only concatenate str (not "int") to str
if i <> 3 : # SyntaxError: invalid syntax
for i in range(10.3): #TypeError: 'float' object cannot be interpreted as an integer
while True:
print() # IndentationError: expected an indented block