تاپل را با یک آیتم ایجاد کنید(Create Tuple With One Item)

برای ایجاد یک تاپل تنها با یک آیتم، باید یک کاما بعد از آیتم اضافه کنید.
مگر اینکه پایتون متغیر را به عنوان یک تاپل تشخیص ندهد.



مثال


One item tuple, remember the commma:



thistuple = ("apple",)

print(type(thistuple))

#NOT a tuple
thistuple = ("apple")

print(type(thistuple))