python characters code example
Example 1: all characters python
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
Example 2: string in python
string = "String"
string = str(string)
s1 = "Str"
s2 = "ing"
s = s1 + s2
Example 3: python char at
>>> s = "python"
>>> s[3]
'h'
>>> s[6]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> s[0]
'p'
>>> s[-1]
'n'
>>> s[-6]
'p'
>>> s[-7]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>>
Example 4: how to get any letter of a string python
Random = "Whatever"
words2 = Random.split(" ")
print('number of letters:')
print(len(Random))
while True:
ask = int(input("what letter do you want?"))
print(Random[ask-1])
Example 5: char in python
there is no dataype as char in python