冰楓論壇

標題: Python 程式寫作 [打印本頁]

作者: asasbed123    時間: 2022-1-26 12:13
標題: Python 程式寫作
媽媽和小明達成協議:
只要期中考80分以上 可以拿到100元 若高於90分每多1分可以多拿2元 98分以上多1分再多給5元 請幫媽媽設計獎金計算程式 請使用if敘述

拜託了!!
作者: a012346790    時間: 2022-1-26 14:20
如果不需要函數的話:

65
作者: ifurther    時間: 2023-10-28 21:32
Grad 是分數
  1. if Grad > 80:
  2.     Money = 100
  3.     if (Bolus := Grad - 98) and Bolus >= 0:
  4.         print( Money + Bolus *  5)
  5.     elif (Bolus := Grad - 90) and Bolus >= 0:
  6.         print( Money + Bolus *  2)
  7.     else:
  8.         print( Money)
  9. else:
  10.     print( 'No moyey')
複製代碼





歡迎光臨 冰楓論壇 (https://bingfong.com/) Powered by 冰楓