Differences between revisions 4 and 6 (spanning 2 versions)
Revision 4 as of 2018-10-28 15:21:48
Size: 868
Comment:
Revision 6 as of 2019-10-16 14:42:15
Size: 868
Comment:
No differences found!

[ edit ]

  • 解答は基本的に,下記 7 行です.

   1 def judge_high_and_low( x, correct_number ):
   2     if x == correct_number:
   3         return( "正解です" )
   4     elif x > correct_number:
   5         return( "大きすぎます" )
   6     else:
   7         return( "小さすぎます" )
  • でも,単純に,正解なら整数の0, 大きすぎるとき正の数,小さすぎるとき負の数を返すと考えれば,単純に引き算で表現できます.

   1 def judge_high_and_low( x, correct_number ):
   2     return( int( x - correct_number ))

SoftEng: Python/Prog/Practice/Extended/02/EP_005a/Digest (last edited 2019-10-16 14:42:15 by TadashiIijima)