编程札记

P

Python3 数字Number Choice 方法

Python3 数字Number Choice 方法 #!/usr/bin/python3 import random print ("returns a random number from range(100) : ",random.choice(range(100))) print ("returns random element from list [1, 2, 3, 5, 9]) : ", random.choice([1, 2, 3, 5, 9])) print ("returns random character from string 'Hello World' : ", random.choice('Hello World'))

阅读全文 ↗
P

Python3 数字Number Sqrt 方法

Python3 数字Number Sqrt 方法 #!/usr/bin/python3 import math # This will import math module print ("math.sqrt(100) : ", math.sqrt(100)) print ("math.sqrt(7) : ", math.sqrt(7)) print ("math.sqrt(math.pi) : ", math.sqrt(math.pi))

阅读全文 ↗
P

Python3 数字Number Round 方法

Python3 数字Number Round 方法 #!/usr/bin/python3 print ("round(70.23456) : ", round(70.23456)) print ("round(56.659,1) : ", round(56.659,1)) print ("round(80.264, 2) : ", round(80.264, 2)) print ("round(100.000056, 3) : ", round(100.000056, 3)) print ("round(-100.000056, 3) : ", round(-100.000056, 3))

阅读全文 ↗
P

Python3 数字Number Pow 方法

Python3 数字Number Pow 方法 #!/usr/bin/python3 import math # This will import math module print ("math.pow(100, 2) : ", math.pow(100, 2)) print ("math.pow(100, -2) : ", math.pow(100, -2)) print ("math.pow(2, 4) : ", math.pow(2, 4)) print ("math.pow(3, 0) : ", math.pow(3, 0))

阅读全文 ↗
P

Python3 数字Number Modf 方法

Python3 数字Number Modf 方法 #!/usr/bin/python3 import math # This will import math module print ("math.modf(100.12) : ", math.modf(100.12)) print ("math.modf(100.72) : ", math.modf(100.72)) print ("math.modf(119) : ", math.modf(119)) print ("math.modf(math.pi) : ", math.modf(math.pi))

阅读全文 ↗
P

Python3 数字Number Min 方法

Python3 数字Number Min 方法 #!/usr/bin/python3 print ("min(80, 100, 1000) : ", min(80, 100, 1000)) print ("min(-20, 100, 400) : ", min(-20, 100, 400)) print ("min(-80, -20, -10) : ", min(-80, -20, -10)) print ("min(0, 100, -400) : ", min(0, 100, -400))

阅读全文 ↗
P

Python3 数字Number Max 方法

Python3 数字Number Max 方法 #!/usr/bin/python3 print ("max(80, 100, 1000) : ", max(80, 100, 1000)) print ("max(-20, 100, 400) : ", max(-20, 100, 400)) print ("max(-80, -20, -10) : ", max(-80, -20, -10)) print ("max(0, 100, -400) : ", max(0, 100, -400))

阅读全文 ↗
P

Python3 数字Number Log10 方法

Python3 数字Number Log10 方法 #!/usr/bin/python3 import math # This will import math module print ("math.log10(100.12) : ", math.log10(100.12)) print ("math.log10(100.72) : ", math.log10(100.72)) print ("math.log10(119) : ", math.log10(119)) print ("math.log10(math.pi) : ", math.log10(math.pi))

阅读全文 ↗
P

Python3 数字Number Log 方法

Python3 数字Number Log 方法 #!/usr/bin/python3 import math # This will import math module print ("math.log(100.12) : ", math.log(100.12)) print ("math.log(100.72) : ", math.log(100.72)) print ("math.log(math.pi) : ", math.log(math.pi))

阅读全文 ↗
P

Python3 number floor method

Python3 number floor method #!/usr/bin/python3 import math # This will import math module print ("math.floor(-45.17) : ", math.floor(-45.17)) print ("math.floor(100.12) : ", math.floor(100.12)) print ("math.floor(100.72) : ", math.floor(100.72)) print ("math.floor(math.pi) : ", math.floor(math.pi))

阅读全文 ↗
P

Python3 数字Number Fabs 方法

Python3 数字Number Fabs 方法 #!/usr/bin/python3 import math # This will import math module print ("math.fabs(-45.17) : ", math.fabs(-45.17)) print ("math.fabs(100.12) : ", math.fabs(100.12)) print ("math.fabs(100.72) : ", math.fabs(100.72)) print ("math.fabs(math.pi) : ", math.fabs(math.pi))

阅读全文 ↗
P

Python3 数字Number Exp 方法

Python3 数字Number Exp 方法 #!/usr/bin/python3 import math # This will import math module print ("math.exp(-45.17) : ", math.exp(-45.17)) print ("math.exp(100.12) : ", math.exp(100.12)) print ("math.exp(100.72) : ", math.exp(100.72)) print ("math.exp(math.pi) : ", math.exp(math.pi))

阅读全文 ↗