Math functions 1. Can't get past it despite the code running OK


#1

Hi there,

I've tried a few ways of coding the second part of this problem, all of which execute correctly, but none of them allow me to successfully submit and continue.

I get the error 'Oops, try again. Your second call to round() should print a floating point number with exactly 3 digits after the decimal.

Can anyone help?

Many Thanks

Adrian



<?php
// Try rounding a floating point number to an integer
// and print it to the screen
$num = 1.68456;
{
$rounded = round($num);
print $rounded;
}
?>
<?php {
print round(1.71254, 3);
}
?>



#2

Please post a link to the exercise so we can test and compare. Thanks.


#3

Hi There. Thanks - here you go...

https://www.codecademy.com/courses/web-beginner-en-7I7Xm/0/4?curriculum_id=5124ef4c78d510dd89003eb8


#4

Not able to reproduce the error. Your code passes for me in FF.


#5

Thanks a lot. After you confirmed the code was correct, I refreshed the original exercise and pasted my code into it. It was accepted. It must be because I deleted some of the comment lines when adding my code.


#6

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.