a ='hello'
b ='world'
c =2
d =4# 字符串加法defstr_add(A, B):
result = A + B
return result
# 字符串乘法defstr_mul(A, B):
result = A * B
return result
# 字符串除法defstr_div(A, B):
result = B / A
return result
# 字符串减法defstr_sub(A, B):
result = B - A
return result
# 字符串不换行defstr_end(A):
result = A
return result
if __name__ =="__main__":print(f"加法{a}+{b} 输出结果为: {str_add(a, b)}")print(f"加法{c}+{d} 输出结果为: {str_add(c, d)}")print(f"乘法{d}*{c} 输出结果为: {str_mul(c, d)}")print(f"乘法{a}*{c} 输出结果为: {str_mul(a, c)}")print(f"除法{d}/{c} 输出结果为: {str_div(c, d)}")print(f"减法{d}-{c} 输出结果为: {str_sub(c, d)}")# 使用 end 参数控制不换行print(f"******")print(f"不换行{a} 输出结果为: {str_end(a)}", end=' ')print(f"不换行{b} 输出结果为: {str_end(b)}", end='##')print(f"******")