AU Fundamentals of Python Programming¶
Ex7-1(練習7-1):M1-Q20 找零錢問題¶
假設銅板有1元、5元、50元共三種,媽媽請小明去菜市場買水果,給了小明 n 元,且媽媽交待,要老闆找小明的零錢的數目要最少,而小明到了水果攤買了 a_1顆蘋果,a_2顆柳丁,及 a_3 顆桃子,1顆蘋果15元,1顆柳丁20元,1顆桃子30元,請問老問需找多少個1元、5元、50元,其銅板數目最少。
Step 1: 先輸入媽媽給小明多少錢 n¶
n=int(input())
---------------------------------------------------------------------------
StdinNotImplementedError Traceback (most recent call last)
/tmp/ipykernel_901/1095811832.py in <module>
----> 1 n=int(input())
~/.local/lib/python3.8/site-packages/ipykernel/kernelbase.py in raw_input(self, prompt)
1001 """
1002 if not self._allow_stdin:
-> 1003 raise StdinNotImplementedError(
1004 "raw_input was called, but this frontend does not support input requests."
1005 )
StdinNotImplementedError: raw_input was called, but this frontend does not support input requests.