Inserting characters in strings in python
Just keep it simple. Check to see if the position is greater than the length of the word then just print the word, else proceed with your logic:
C = input("Choose your charecter to insert. ")
P = int(input("Choose your character's position. "))
S = input("Choose your string. ")
if P > len(S):
print(S)
else:
st = S[:P] + C + S[P:]
print(st)
print(C, P, S)
Theres also this :)
result = list(S).insert(P, C)
if result:
print(result)
else:
print(S)