这个python问题该怎么解决啊?

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图
运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

img

def text_index(string,index):
    print(string[index])

str_x = ''
num = 0
try:
    str_x = pass
    num = pass
    text_index(str_x,num)
    str_x + num
except:
    pass
else:
   pass
finally:
   pass

def text_index(string,index):
    print(string[index])
 
str_x = ''
num = 0
try:
    str_x = input()
    num = int(input())
    text_index(str_x,num)
    str_x + num
except Exception as e:
    print(repr(e))

主要是这几句,测试的时候依次下面三种输入,都会报错

abc
a
ValueError("invalid literal for int() with base 10: 'a'")

abc
3
IndexError('string index out of range')

abc
2
c
TypeError('can only concatenate str (not "int") to str')