Python Forum

Full Version: How to find the cosine of an angle
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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)
import math

r = 2.13493356 

cos = math.cos(x) # the argument is radians

print(cos)
Output:
-0.5346869338289935
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'
(May-25-2017, 03:43 PM)sylas Wrote: [ -> ]For paste I go in the middle of your string
you need to remove the placeholder text - delete it before paste or select it and then paste
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"
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'
I will try again on my next file.