Please where am i not getting it right to get the third character | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок

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
17 ответов
+ 3
Oh dyou tryna tag me?
31st Mar 2022, 4:28 PM
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
+ 2
str = "hello" No need of square brackets (assuming its Python)
31st Mar 2022, 8:58 AM
Infinity - avatar
+ 1
You don't capitalize the 'p' in print()
31st Mar 2022, 9:03 AM
Slick - avatar
+ 1
str = "hello" print(str[2])
31st Mar 2022, 9:13 AM
NEZ - avatar
31st Mar 2022, 10:00 AM
Infinity - 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 - avatar
+ 1
Manav ROY Please ho do i get d code u asking for
2nd Apr 2022, 8:30 PM
Joseph Oyelami
Am not still on it please someone help
31st Mar 2022, 9:08 AM
Joseph Oyelami
It still did not work on d practice
31st Mar 2022, 2:30 PM
Joseph Oyelami
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
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
Python is case - sensitive. so, you should use print instead of Print
1st Apr 2022, 5:18 PM
Penumudi Lavanya
Penumudi Lavanya - avatar
- 1
1st Apr 2022, 2:11 PM
Usein Akbar
Usein Akbar - avatar