A Python tuple that has only one element without a trailing comma is not a tuple

A Python tuple that has only one element without a trailing comma is not regarded a tuple.

s = ('Apple')
t = (13)
u = (24,)

print(s)  # Apple
print(t)  # 13
print(u)  # (24,)

print(type(s))  # <class 'str'>
print(type(t))  # <class 'int'>
print(type(u))  # <class 'tuple'>

u has a trailing comma so is a tuple.

Python Tuple

Python Tutorial