0

Why it's not complete (list python), help me pliss

Write a program that takes an input string and outputs the 3rd character of the string. My code: Word = input() Print(word[3]) It's just work for 1 chase, please help me

28th Aug 2021, 2:29 AM
Syekh Guntur Amara Putra
Syekh Guntur Amara Putra - avatar
4 Answers
+ 4
To print the 3rd character of the string, you should print index 2 i.e print(word[2]) because index of python list starts from 0. a b c d e ... 0 1 2 3 4 .... So the third character 'c' has index 2. similarly, a, b, d, and e has indices 0, 1, 3, and 4 respectively..
28th Aug 2021, 2:53 AM
Sacar
Sacar - avatar
+ 2
In your code print(word[3]) prints 4th character of the string
28th Aug 2021, 2:57 AM
Sacar
Sacar - avatar
+ 2
Ok, Delicate Cat thx for sharing
28th Aug 2021, 5:37 AM
Syekh Guntur Amara Putra
Syekh Guntur Amara Putra - avatar
+ 1
Thx bro I forgot about it
28th Aug 2021, 3:12 AM
Syekh Guntur Amara Putra
Syekh Guntur Amara Putra - avatar