0

What is the result of this code?

What is the result of this code? letters = ["a", "b", "c"] letters.append("d") print(len(letters)) _

24th May 2017, 3:18 AM
Bianca
10 odpowiedzi
+ 12
The result should be: 4. After the 2nd statement, "d" is added to the list. So, letters contains 4 items.
24th May 2017, 3:28 AM
Bàng Tứ Cường
Bàng Tứ Cường - avatar
+ 9
4
24th May 2017, 5:09 AM
Shivanand Nagarabetta
Shivanand Nagarabetta - avatar
+ 8
Ruby Quiz Question Oh.. no that mine I submitted it to Sololearn and it approved.(Notice just now in submission)
24th May 2017, 6:35 AM
Ekansh
+ 3
The answer is 4. as the "append" part adds your required value at the end of the pre-defined list , thus after using append it becomes a part of the list from the end.
7th Jun 2017, 3:40 PM
Yash Bhanushali
Yash Bhanushali - avatar
+ 2
Lists almost behaves like strings. So 4
1st Jun 2017, 3:45 AM
Rams
0
It prints 4, because the list end as follows: letters = ["a", "b", "c", "d"]
10th Jun 2017, 7:00 PM
FernAg
FernAg - avatar
0
4
18th Jul 2022, 1:32 PM
wessam lahmod
0
yes 4
9th Nov 2022, 6:00 AM
kinzang namgay
kinzang namgay - avatar
0
4 🙂
15th Dec 2022, 7:54 PM
sajad heydari
sajad heydari - avatar
- 1
what is the result of this code? List=["vahid", "eslami", [" Iran", "tehran]] print(List[2][1][-3])
15th Oct 2018, 10:08 AM
Vahid Eslami
Vahid Eslami - avatar