What is the correction of this in Python ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the correction of this in Python ?

name="yasser" name1="maoz" name2="yhya" print(name.[3]) print(name1.index("a")) print(name2.[5])

4th Jun 2020, 7:30 PM
y66s6
y66s6 - avatar
1 Answer
+ 1
print(name[3]), not name.[3] print(name2[5]), not name2.[5] indexing by square brackets is not a method, it is a special operation that access an iterable by its elements' indices.
4th Jun 2020, 7:36 PM
Ali Abdelhady
Ali Abdelhady - avatar