Python - Comma after a number within a tuple, what does it do? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 1

Python - Comma after a number within a tuple, what does it do?

zzz = ((123,)) + (456,) print(zzz) #outputs (123, 456) Aside from preventing mathematical evaluations, are there any other purpose for having the commas in line 1?

12th Oct 2020, 9:43 PM
Solus
Solus - avatar
1 ответ
+ 4
it makes it a tuple. otherwise itd just be a number in some parenthesis. try stuff out
12th Oct 2020, 10:00 PM
Slick
Slick - avatar