P 2026-11-06 Python3 数字Number Sin Function #!/usr/bin/python3 import math print ("sin(3) : ", math.sin(3)) print ("sin(-3) : ", math.sin(-3)) print ("sin(0) : ", math.sin(0)) print ("sin(math.pi) : ", math.sin(math.pi)) print ("sin(math.pi/2) : ", math.sin(math.pi/2))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Hypot Function #!/usr/bin/python3 import math print ("hypot(3, 2) : ", math.hypot(3, 2)) print ("hypot(-3, 3) : ", math.hypot(-3, 3)) print ("hypot(0, 2) : ", math.hypot(0, 2))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Cos Function #!/usr/bin/python3 import math print ("cos(3) : ", math.cos(3)) print ("cos(-3) : ", math.cos(-3)) print ("cos(0) : ", math.cos(0)) print ("cos(math.pi) : ", math.cos(math.pi)) print ("cos(2*math.pi) : ", math.cos(2*math.pi))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Atan2 Function #!/usr/bin/python3 import math print ("atan2(-0.50,-0.50) : ", math.atan2(-0.50,-0.50)) print ("atan2(0.50,0.50) : ", math.atan2(0.50,0.50)) print ("atan2(5,5) : ", math.atan2(5,5)) print ("atan2(-10,10) : ", math.atan2(-10,10)) print ("atan2(10,20) : ", math.atan2(10,20))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Atan Function #!/usr/bin/python3 import math print ("atan(0.64) : ", math.atan(0.64)) print ("atan(0) : ", math.atan(0)) print ("atan(10) : ", math.atan(10)) print ("atan(-1) : ", math.atan(-1)) print ("atan(1) : ", math.atan(1))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Asin Function #!/usr/bin/python3 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))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Acos Function #!/usr/bin/python3 import math print ("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))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Uniform 方法 #!/usr/bin/python3 import random print ("Random Float uniform(5, 10) : ", random.uniform(5, 10)) print ("Random Float uniform(7, 14) : ", random.uniform(7, 14))
阅读全文 ↗ P 2026-11-06 Python3 数字Number Shuffle 方法 #!/usr/bin/python3 import random list = [20, 16, 10, 5]; random.shuffle(list) print ("Reshuffled list : ", list) random.shuffle(list) print ("Reshuffled list : ", list)
阅读全文 ↗ P 2026-11-06 Python3 数字Number Seed 方法 #!/usr/bin/python3 import random random.seed() print ("random number with default seed", random.random()) random.seed(10) print ("random number with int seed", random.random()) random.seed("hello",2) print ("random number with string seed", random.random())
阅读全文 ↗ P 2026-11-06 Python3 数字Number Random 方法 #!/usr/bin/python3 import random # First random number print ("random() : ", random.random()) # Second random number print ("random() : ", random.random())
阅读全文 ↗ P 2026-11-06 Python3 数字Number Randrange 方法 #!/usr/bin/python3 import random # randomly select an odd number between 1-100 print ("randrange(1,100, 2) : ", random.randrange(1, 100, 2)) # randomly select a number between 0-99 print ("randrange(100) : ", random.randrange(100))
阅读全文 ↗