Python TQC考題204_算術運算
a=eval(input())
b=eval(input())
op=input()
if op==“+”:
print(a+b)
elif op==”-“:
print(a-b)
elif op==”*”:
print(a*b)
elif op==”/”:
print(a/b)
elif op==”//”:
print(a//b)
# //除法求整數
elif op==”%”:
print(a%b)
# %除法求餘數
#最後不一定要用else: 結尾
Spyder執行結果:







![Python: matplotlib繪製出的圖表如何插入背景圖? img = plt.imread(‘background_image.png’) ; ax.imshow(img, extent=[0, 10, -1.2, 1.2], aspect=’auto’, alpha=0.5) Python: matplotlib繪製出的圖表如何插入背景圖? img = plt.imread(‘background_image.png’) ; ax.imshow(img, extent=[0, 10, -1.2, 1.2], aspect=’auto’, alpha=0.5)](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2023/02/20230216183536_29.png?quality=90&zoom=2&ssl=1&resize=350%2C233)





近期留言