How the output is 1 ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

How the output is 1 ?

a = (11,5,7,2,2) a = str(a) print(a[2]) Please Explain, How the output is 1?

26th Jun 2020, 6:01 PM
Olivia Munn 🙋🤷‍♀
Olivia Munn 🙋🤷‍♀ - avatar
3 Answers
+ 17
Well, a is "(11, 5, 7, 2, 2)". A character with index 2 is "1". This is how :)
26th Jun 2020, 6:05 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 12
so, a[0] is '(' , right ?
26th Jun 2020, 6:10 PM
Olivia Munn 🙋🤷‍♀
Olivia Munn 🙋🤷‍♀ - avatar
+ 9
Exactly
26th Jun 2020, 6:11 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar