The code is in the original post by @courseninja30070 is fine. Perhaps a strange glitch occurred, and the page needed to be refreshed in order to get it to work.
Regarding the parentheses, @tjsully's code is also correct. The only place where the parentheses are really needed in that expression is in calling the
Since some of the parentheses used here are optional, @byteace91888's code also works correctly.
Parentheses can be used to control the order of operations in an expression. See Operator precedence to decide when they are actually needed. However, programmers sometimes use them where they are not required, in order to make the order of operations clear.