class Item:
serial_counter = 1000
def __init__(self):
Item.serial_counter += 1
self.id_number = Item.serial_counter
item1 = Item()
item2 = Item()
item3 = Item()
print(item1.id_number) # 1001
print(item2.id_number) # 1002
print(item3.id_number) # 1003
To embed this project on your website, copy the following code and paste it into your website's HTML: