int object is not subscriptable in python

"""
This error means the variable you want to subscript is an integer.

if you want to subscript an int, a way of doing that is turning it to str.
"""
num = 1234
x = num[2]  # does not work
x = int(str(num)[2])  # works, x = 3

Here is what the above code is Doing:
1. num = 1234
2. num = ‘1234’
3. x = ‘3’
4. x = 3