設計によるセレンディピティ

"The most powerful force in the universe is compound interest."

『小中学生からはじめるプログラミングの本』のスクリプト

インデント等,本に書かれているように書きます.

p.14

<script>
 a=1;
 b=1;
 while(a<10000){
  a++;
  b=b+a;
 }
 document.write(b);
</script>

p.15

<script
 src="http://maps.google.com/maps/api/js">
</script>
<script>
 navigator.geolocation.getCurrentPosition(
 function(a){b=new
  google.maps.LatLng(a.coords.latitude,
  a.coords.longitude);new
  google.maps.Marker({position:b, map:new
  google.maps.Map(document.getElementById("c"),
  {zoom: 17, center:b})});
});
</script>
<div id="c" style="width:100%; height: 100%">
</div>

p.129 図10−2

def bmicheck(shintyou, taijuu):
    bmi=taijuu/((shintyou/100)**2)
    message="BMIは%.1fです。"
    if bmi>=25:
        message=message+"肥満です"
    print(message % bmi)

bmicheck(170,60)
bmicheck(170,80)