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

Functions, Part I Forum

View Course » View Exercise

475 points
537272309c4e9d121c0000c6_475618801
Submitted by
Lourdes Vargas Rivera
over 3 years ago

What is wrong whit this code????

I don't know why, but it keeps telling me that my code is wrong and I don't see the error... help please!!

<?php

    $round = round(M_PI);
    print $round;

?>
</p>
<p>
<?php

    $round = round(3.142);
    print $round;    

?>
</p>

1 vote

permalink

Change the second $round to the following:

$round = round(M_PI,3) // M_PI can be replaced with any number with multiple decimal points, 3 is the amount of decimal points you will round up or down to.

562 points
372c0e891ace699b08e836b13dfeead7?s=140&d=retro
Submitted by
Rvervuurt
over 3 years ago

1 Comment

537272309c4e9d121c0000c6_475618801 Lourdes Vargas Rivera over 3 years ago

thank u for ur help!! :D


0 votes

permalink

In the second $round, you're supposed to write $round = round (M_PI, 4); (it might be 3)
you are telling it to round off at 4 numbers (or decimal points) don't really remember haha

103 points
Picture
Submitted by
magical14
over 3 years ago

1 Comment

537272309c4e9d121c0000c6_475618801 Lourdes Vargas Rivera over 3 years ago

thanks!! :)