How do i import mathematical functions like pi and sin and cosine into repl.it?

I’m trying to write code that needs the use of Pi and sin and etc. and I’m not sure how to properly use it. It seems that math. sin and math.pi doesn’t work.

What language are you using? This is really not a replit problem, an entirely a language/ library problem.

I completely forgot to mention it, sorry! Im using python 3

If you’re using python3, try using the math library to import math. For example:

import math
math.sin(num)
3 Likes

Hmmm, how does math.sin and math.pi not work? Are you getting errors or are the calculations wrong? (And unlike js, python’s math lib is not imported by default)

Yea thank you! I used import.math and it was a complete logical error on my end.

3 Likes

It was a logical error on my end. I used import.math instead of import math.

1 Like

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