Python Tutorial ( PDFDrive )
degrees(x)radians(x)Converts angle x from radians to degrees.Converts angle x from degrees to radians.The Trigonometric Functions are explained here:acos(x) Description The method acos() returns the arc cosine of x, in radians.Syntax Following is the syntax for acos() method:acos(x)Note: This function is not accessible directly, so we need to import math module and then we need to call thisfunction using math static object.Parameters • x -- This must be a numeric value in the range -1 to 1. If x is greater than 1 then it will generate an error.Return Value This method returns arc cosine of x, in radians.Example The following example shows the usage of acos() method.#!/usr/bin/pythonimport mathprint "acos(0.64) : ", math.acos(0.64)print "acos(0) : ", math.acos(0)print "acos(-1) : ", math.acos(-1)print "acos(1) : ", math.acos(1)Let us compile and run the above program, this will produce the following result:acos(0.64) : 0.876298061168acos(0) : 1.57079632679acos(-1) : 3.14159265359acos(1) : 0.0asin(x) Description The method asin() returns the arc sine of x, in radians.Syntax Following is the syntax for asin() method:TUTORIALS POINT Simply Easy Learning
asin(x)Note: This function is not accessible directly, so we need to import math module and then we need to call thisfunction using math static object.Parameters • x -- This must be a numeric value in the range -1 to 1. If x is greater than 1 then it will generate an error.Return Value This method returns arc sine of x, in radians.Example The following example shows the usage of asin() method.#!/usr/bin/pythonimport mathprint "asin(0.64) : ", math.asin(0.64)print "asin(0) : ", math.asin(0)print "asin(-1) : ", math.asin(-1)print "asin(1) : ", math.asin(1)Let us compile and run the above program, this will produce the following result:asin(0.64) : 0.694498265627asin(0) : 0.0asin(-1) : -1.57079632679asin(1) : 1.57079632679atan(x) Description The method atan() returns the arc tangent of x, in radians.Syntax Following is the syntax for atan() method:atan(x)Note: This function is not accessible directly, so we need to import math module and then we need to call thisfunction using math static object.Parameters • x -- This must be a numeric value.Return Value This method returns arc tangent of x, in radians.TUTORIALS POINT Simply Easy Learning
- Page 61 and 62: FunctionDescriptionint(x [,base])Co
- Page 63 and 64: CHAPTER5Python Basic OperatorsWhat
- Page 65 and 66: Line 4 - Value of c is 2Line 5 - Va
- Page 67 and 68: Line 5 - a is greater than bLine 6
- Page 69 and 70: | Binary OR Operator copies a bit i
- Page 71 and 72: else:print "Line 3 - a and b are tr
- Page 73 and 74: if ( id(a) == id(b) ):print "Line 2
- Page 75 and 76: When you execute the above program,
- Page 77 and 78: if statementsif...else statementsne
- Page 79 and 80: Example: #!/usr/bin/pythonvar1 = 10
- Page 81 and 82: else:print "Could not find true exp
- Page 83 and 84: Loop Typewhile loopfor loopDescript
- Page 85 and 86: num = raw_input("Enter a number :")
- Page 87 and 88: Good bye!Iterating by Sequence I
- Page 89 and 90: 11 is prime13 is prime17 is prime19
- Page 91 and 92: continue statement The continue st
- Page 93 and 94: CHAPTER8Python NumbersNumber data t
- Page 95 and 96: max(x1, x2,...)min(x1, x2,...)modf(
- Page 97 and 98: Syntax Following is the syntax for
- Page 99 and 100: import math# This will import math
- Page 101 and 102: import mathmath.log10( x )Note: Thi
- Page 103 and 104: modf(x) Description The method modf
- Page 105 and 106: round( x [, n] )Parameters • x --
- Page 107 and 108: Return Value This method returns a
- Page 109 and 110: seed([x]) Description The method se
- Page 111: Syntax Following is the syntax for
- Page 115 and 116: print "atan2(-10,10) : ", math.atan
- Page 117 and 118: Note: This function is not accessib
- Page 119 and 120: import mathprint "degrees(3) : ", m
- Page 121 and 122: CHAPTER9Python StringsStrings are a
- Page 123 and 124: + Concatenation - Adds values on ei
- Page 125 and 126: TAB ( \t ) and they will show up th
- Page 127 and 128: 14151617181920212223242526272829303
- Page 129 and 130: str = "this is string example....wo
- Page 131 and 132: Return Value This method returns a
- Page 133 and 134: Description The method expandtabs()
- Page 135 and 136: Traceback (most recent call last):F
- Page 137 and 138: Let us compile and run the above pr
- Page 139 and 140: str = "This is string example....wo
- Page 141 and 142: str = "-";seq = ("a", "b", "c"); #
- Page 143 and 144: lstrip() Description The method lst
- Page 145 and 146: Max character: xmin(str) Descriptio
- Page 147 and 148: str = "this is really a string exam
- Page 149 and 150: Parameters • chars -- You can sup
- Page 151 and 152: Parameters• str -- This is the st
- Page 153 and 154: Parameters • NAReturn Value This
- Page 155 and 156: Example The following example shows
- Page 157 and 158: CHAPTER10Python ListsThe most basic
- Page 159 and 160: Python Expression Results Descripti
- Page 161 and 162: Syntax Following is the syntax for
asin(x)
Note: This function is not accessible directly, so we need to import math module and then we need to call this
function using math static object.
Parameters
• x -- This must be a numeric value in the range -1 to 1. If x is greater than 1 then it will generate an error.
Return Value
This method returns arc sine of x, in radians.
Example
The following example shows the usage of asin() method.
#!/usr/bin/python
import math
print "asin(0.64) : ", math.asin(0.64)
print "asin(0) : ", math.asin(0)
print "asin(-1) : ", math.asin(-1)
print "asin(1) : ", math.asin(1)
Let us compile and run the above program, this will produce the following result:
asin(0.64) : 0.694498265627
asin(0) : 0.0
asin(-1) : -1.57079632679
asin(1) : 1.57079632679
atan(x)
Description
The method atan() returns the arc tangent of x, in radians.
Syntax
Following is the syntax for atan() method:
atan(x)
Note: This function is not accessible directly, so we need to import math module and then we need to call this
function using math static object.
Parameters
• x -- This must be a numeric value.
Return Value
This method returns arc tangent of x, in radians.
TUTORIALS POINT
Simply Easy Learning