|
小弟程式初學者,最近一直苦思如何將下列程式簡化
if 0 <= X and X < 300 then Y = 3;
if 300 <= X and X < 600 then Y = 6;
if 600 <= X and X < 900 then Y = 9;
if 900 <= X and X < 1200 then Y = 12;
if ..................................
if........................
.............
.........
if 2700 <= X and X < 3000 then Y = 30;
我有把數字設計成有邏輯,但在語法上實在所學有限,
麻煩路過的高手幫個忙了
|
|