How to find the cosine of an angle - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to find the cosine of an angle (/thread-3461.html) |
How to find the cosine of an angle - sylas - May-25-2017 my question here:Hi all. I have not received my book yet, so I am unable to go on. #file2.py #module # Import built-in module math import math#the module is 'math' content = dir(math) print(content) y=cos(pi/6)#NameError: 'cos' is not defined z=math.y print(z) RE: How to find the cosine of an angle - wavic - May-25-2017 import math r = 2.13493356 cos = math.cos(x) # the argument is radians print(cos)
RE: How to find the cosine of an angle - sylas - May-25-2017 Thanks, it works well. So r is an angle.For the coded tag I first begun with "copy as plain'text'" It is in the options of Edit of in pyCharm...For paste I go in the middle of your string. Right click, press 'paste' RE: How to find the cosine of an angle - buran - May-25-2017 (May-25-2017, 03:43 PM)sylas Wrote: For paste I go in the middle of your stringyou need to remove the placeholder text - delete it before paste or select it and then paste RE: How to find the cosine of an angle - sylas - May-25-2017 I go in the middle of the string, "code, here code'. I don't remember exactly this string. I right click, Between the options ypu have "paste". I choose that, press it,, and it is OK. Nowhere a "delete" RE: How to find the cosine of an angle - buran - May-25-2017 I mean, delete text 'your code here'. It is just a placeholder for your code - as a hint where to paste your code. I edited your first, because your code has been paste between 'your code' and 'here' RE: How to find the cosine of an angle - sylas - May-25-2017 I will try again on my next file. |