one new question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

one new question

Hey again , thank you for everyone i have now another question what i cant understand somthing , and i want some body answer the question and try to explain for me how he did it sa i understand . i cant understand very good Lists Remember, strings can be indexed like lists. Write a program that takes an input string and outputs the 3rd character of the string. Sample Input Hello Sample Output l ------ Thank u again

8th Oct 2021, 2:37 PM
Raoof Zakarna
4 Answers
+ 2
string= input() #string[position] print(string[2])
8th Oct 2021, 2:52 PM
ubai
ubai - avatar
+ 4
You can use index ([]) to access any character in a String. Syntax: str[index] In your exercise, you have to take a String from the user and print the third character. Remember that indices start from zero. someText = input() print(someText[2]) or print(input()[2])
8th Oct 2021, 2:51 PM
Erlénio.RS
Erlénio.RS - avatar
+ 2
Yes i understand and this working good , thank you very much
8th Oct 2021, 3:01 PM
Raoof Zakarna
0
For the future: 1. Please always mention the programming language you're asking about in the tags. 2. Please use meaningful titles. https://www.sololearn.com/discuss/333866/?ref=app https://code.sololearn.com/W3uiji9X28C1/?ref=app
8th Oct 2021, 8:42 PM
Simon Sauter
Simon Sauter - avatar