This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Functions, Part I Forum

View Course » View Exercise

1157 points
1fd1601a6654f4f1164c8bc7b19f2358?s=140&d=retro
Submitted by
Bryan
over 2 years ago

1.4: But this IS an integer...

My code:

<?php
$round = round(MPI);
print $round;


<?php
$round
decimal = round(MPI, 2);
print $round
decimal;

?>

This code apparently does not print an integer for "round(M_PI)" when it should round to 3.
Any idea what's wrong?


0 votes

permalink

you forgot to write "?>" after 'print $round;'
and it's 'M_PI' not 'MPI'

709 points
556057b89113cb374700041b_986834384
Submitted by
Magnus RC
over 2 years ago

2 Comments

1fd1601a6654f4f1164c8bc7b19f2358?s=140&d=retro Bryan over 2 years ago

Actually, I typed out MPI with an underscore, but for some reason when I typed out the question in the forum it defaulted to italic instead of underscore. So yes, I typed MPI.

01e469b9f86ef7e4f8f6c38a30adbce8?s=140&d=retro Colls over 2 years ago

Try typing $rounddecimal = round(M_PI, 3); instead of the 2. This worked for me