1# Get First 3 character of a string in python
2first_chars = sample_str[0:3]
3print('First 3 characters: ', first_chars)
4
5# Output:
6First 3 characters: Hel
1Random = "Whatever"#you can put anything here
2words2 = Random.split(" ")
3print('number of letters:')#you can delete this line...
4print(len(Random))#and this one. these lines just Tell you how many
5#letters there are
6while True:#you can get rid of this loop if you want
7 ask = int(input("what letter do you want?"))
8 print(Random[ask-1])
1# An example text
2text = "This is text"
3# print the [0] first character of the sample text,
4# [4] fifth character,
5# [0: 4] first to fifth character,
6# [-1] last character.
7print(tekst[0], tekst[4], tekst[0:4], tekst[-1])