0

Please where am i not getting it right to get the third character

str = ["hello"] Print(str[2])

31st Mar 2022, 8:53 AM
Joseph Oyelami
23 Answers
+ 3
Oh dyou tryna tag me?
31st Mar 2022, 4:28 PM
Rishi
Rishi - avatar
+ 3
You added square brackets which means python take this as a list not string , hence error
1st Apr 2022, 7:19 PM
Yusra
Yusra - avatar
+ 2
str = "hello" No need of square brackets (assuming its Python)
31st Mar 2022, 8:58 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 1
You don't capitalize the 'p' in print()
31st Mar 2022, 9:03 AM
Slick
Slick - avatar
+ 1
str = "hello" print(str[2])
31st Mar 2022, 9:13 AM
NEZ
NEZ - avatar
31st Mar 2022, 10:00 AM
Abhishek Tandon
Abhishek Tandon - avatar
+ 1
Don't put squars brakes while defining the string. That will solve your problem. Try like this: str = "hello" print(str[2])
1st Apr 2022, 1:13 AM
Md Arif Shahriyar Sohan
Md Arif Shahriyar Sohan - avatar
+ 1
Maybe, str is an input variable. Also, don't use inbuilt function name as variable. string = input() print(string[2])
1st Apr 2022, 4:19 AM
Simba
Simba - avatar
+ 1
Manav ROY Please ho do i get d code u asking for
2nd Apr 2022, 8:30 PM
Joseph Oyelami
0
Am not still on it please someone help
31st Mar 2022, 9:08 AM
Joseph Oyelami
0
It still did not work on d practice
31st Mar 2022, 2:30 PM
Joseph Oyelami
0
Manav Roy i have not activate my account so i can't get to u through d message is there any way out or something else u can think off
31st Mar 2022, 7:34 PM
Joseph Oyelami
0
str="hello" print(str[2]) This is how the code is run it and you will get it done
31st Mar 2022, 8:11 PM
Clinton
0
Python is case - sensitive. so, you should use print instead of Print
1st Apr 2022, 5:18 PM
Penumudi Lavanya
Penumudi Lavanya - avatar
- 1
H
1st Apr 2022, 2:11 PM
Usein Akbar
Usein Akbar - avatar
- 3
It still did not work
31st Mar 2022, 9:01 AM
Joseph Oyelami