Results of 1 - 10 of about 26 for factorial (0.011 sec.)
- doctest --- 対話型の Python の例をテストする — Python 3.14.8 ドキュメント 11803
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » doctest --- 対話型の Python の例をテストする テーマ 自動 ライト ダーク | doctest --- 対話型の Python の例をテストする
...もなります。 以下に完全かつ短い実行例を示します: """ This is the "example" module. The example module supplies one function, factorial(). For example, >>> factorial(5) 120 """ def factorial ( n ): """Return the factorial of n, an exact integer >= 0. >>> [fa...ctorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] >>> factorial(30) 265252859812191058636308480000000 >>> factorial(-1) Traceback (most recent call last): ... ValueError: n must be >= 0...Factorials of floats are OK, but the float must be an exact integer: >>> factorial(30.1) Traceback (most recent call last): ... ValueError: n must be exact integer >>> factorial(30.0) 265252859812191058636... - https://man.mtool.work/python/3.14/library/doctest.html
- doctest --- 対話型の Python の例をテストする — Python 3.14.8 ドキュメント 11803
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 開発ツール » doctest --- 対話型の Python の例をテストする テーマ 自動 ライト ダーク | doctest --- 対話型の Python の例をテストする
...もなります。 以下に完全かつ短い実行例を示します: """ This is the "example" module. The example module supplies one function, factorial(). For example, >>> factorial(5) 120 """ def factorial ( n ): """Return the factorial of n, an exact integer >= 0. >>> [fa...ctorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] >>> factorial(30) 265252859812191058636308480000000 >>> factorial(-1) Traceback (most recent call last): ... ValueError: n must be >= 0...Factorials of floats are OK, but the float must be an exact integer: >>> factorial(30.1) Traceback (most recent call last): ... ValueError: n must be exact integer >>> factorial(30.0) 265252859812191058636... - https://man.mtool.work/python/3.14/library/doctest.html
- Coroutines and tasks — Python 3.14.8 ドキュメント 11522
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » Coroutines and tasks テーマ 自動 ライト ダーク | Coroutines and tasks ¶
...kGroup will, while gather will not, cancel the remaining scheduled tasks. 以下はプログラム例です: import asyncio async def factorial ( name , number ): f = 1 for i in range ( 2 , number + 1 ): print ( f "Task { name } : Compute factorial( { number } ), cu...rrently i= { i } ..." ) await asyncio . sleep ( 1 ) f *= i print ( f "Task { name } : factorial( { number } ) = { f } " ) return f async def main (): # Schedule three calls *concurrently*: L = await asyncio . gather (...factorial ( "A" , 2 ), factorial ( "B" , 3 ), factorial ( "C" , 4 ), ) print ( L ) asyncio . run ( main ()) # Expected output: # # Task A: Compute factoria... - https://man.mtool.work/python/3.14/library/asyncio-task.html
- Coroutines and tasks — Python 3.14.8 ドキュメント 11522
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » ネットワーク通信とプロセス間通信 » asyncio --- 非同期 I/O » Coroutines and tasks テーマ 自動 ライト ダーク | Coroutines and tasks ¶
...kGroup will, while gather will not, cancel the remaining scheduled tasks. 以下はプログラム例です: import asyncio async def factorial ( name , number ): f = 1 for i in range ( 2 , number + 1 ): print ( f "Task { name } : Compute factorial( { number } ), cu...rrently i= { i } ..." ) await asyncio . sleep ( 1 ) f *= i print ( f "Task { name } : factorial( { number } ) = { f } " ) return f async def main (): # Schedule three calls *concurrently*: L = await asyncio . gather (...factorial ( "A" , 2 ), factorial ( "B" , 3 ), factorial ( "C" , 4 ), ) print ( L ) asyncio . run ( main ()) # Expected output: # # Task A: Compute factoria... - https://man.mtool.work/python/3.14/library/asyncio-task.html
- functools --- 高階関数と呼び出し可能オブジェクトの操作 — Python 3.14.8 ドキュメ... 9555
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » functools --- 高階関数と呼び出し可能オブジェクトの操作 テーマ 自動 ライト ダーク | functools ---
...cause it never needs to evict old values, this is smaller and faster than @lru_cache with a size limit. 例えば: @cache def factorial ( n ): return n * factorial ( n - 1 ) if n else 1 >>> factorial ( 10 ) # no previously cached result, makes 11 recursive c...alls 3628800 >>> factorial ( 5 ) # no new calls, just returns the cached result 120 >>> factorial ( 12 ) # two new recursive calls, factorial(10) is...cache cached function property キャッシュ maxsize functools return lru 属性 functions 場合 calls wrapped key arguments def factorial once instance 目次 functools --- 高階関数と呼び出し可能オブジェクトの操作 partial オブジェクト 前のトピックへ itertools --... - https://man.mtool.work/python/3.14/library/functools.html
- functools --- 高階関数と呼び出し可能オブジェクトの操作 — Python 3.14.8 ドキュメ... 9555
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » functools --- 高階関数と呼び出し可能オブジェクトの操作 テーマ 自動 ライト ダーク | functools ---
...cause it never needs to evict old values, this is smaller and faster than @lru_cache with a size limit. 例えば: @cache def factorial ( n ): return n * factorial ( n - 1 ) if n else 1 >>> factorial ( 10 ) # no previously cached result, makes 11 recursive c...alls 3628800 >>> factorial ( 5 ) # no new calls, just returns the cached result 120 >>> factorial ( 12 ) # two new recursive calls, factorial(10) is...matically. 関連キーワード cache cached property キャッシュ maxsize functools return 属性 functions calls wrapped arguments factorial once instance デコレータ values more call self dict typed used module treated 目次 functools --- 高階関数と呼び出し可能オブ... - https://man.mtool.work/python/3.14/library/functools.html
- What's New in Python 2.6 — Python 3.14.8 ドキュメント 9141
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.6 テーマ 自動 ライト ダーク | What's New in Python 2.6 ¶ 著者 : A.M. Kuchling (amk at amk.ca) This article explains
...入力が 4 の倍数だととっても時間がかかるように仕組んであります。 import time from multiprocessing import Process , Queue def factorial ( queue , N ): "Compute a factorial." # If N is a multiple of 4, this function will take much longer. if ( N % 4 ) == 0 :...Put the result on the queue queue . put ( fact ) if __name__ == '__main__' : queue = Queue () N = 5 p = Process ( target = factorial , args = ( queue , N )) p . start () p . join () result = queue . get () print 'Factorial' , N , '=' , result Queue が fac...s a Pool to spread requests across 5 worker processes and retrieve a list of results: from multiprocessing import Pool def factorial ( N , dictionary ): "Compute a factorial." ... p = Pool ( 5 ) result = p . map ( factorial , range ( 1 , 1000 , 10 )) for... - https://man.mtool.work/python/3.14/whatsnew/2.6.html
- What's New in Python 2.6 — Python 3.14.8 ドキュメント 9141
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.6 テーマ 自動 ライト ダーク | What's New in Python 2.6 ¶ 著者 : A.M. Kuchling (amk at amk.ca) This article explains
...入力が 4 の倍数だととっても時間がかかるように仕組んであります。 import time from multiprocessing import Process , Queue def factorial ( queue , N ): "Compute a factorial." # If N is a multiple of 4, this function will take much longer. if ( N % 4 ) == 0 :...Put the result on the queue queue . put ( fact ) if __name__ == '__main__' : queue = Queue () N = 5 p = Process ( target = factorial , args = ( queue , N )) p . start () p . join () result = queue . get () print 'Factorial' , N , '=' , result Queue が fac...s a Pool to spread requests across 5 worker processes and retrieve a list of results: from multiprocessing import Pool def factorial ( N , dictionary ): "Compute a factorial." ... p = Pool ( 5 ) result = p . map ( factorial , range ( 1 , 1000 , 10 )) for... - https://man.mtool.work/python/3.14/whatsnew/2.6.html
- math --- 数学関数 — Python 3.14.8 ドキュメント 8001
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 数値と数学モジュール » math --- 数学関数 テーマ 自動 ライト ダーク | math --- 数学関数 ¶ This module provides access to common math
...。 Number-theoretic functions comb(n, k) Number of ways to choose k items from n items without repetition and without order factorial(n) n の階乗 gcd(*integers) 整数引数の最大公約数 isqrt(n) Integer square root of a nonnegative integer n lcm(*integers) Lea...of the arguments are not integers. Raises ValueError if either of the arguments are negative. Added in version 3.8. math. factorial ( n ) ¶ Return factorial of the nonnegative integer n . バージョン 3.10 で変更: Floats with integral values (like 5.0 ) ar... - https://man.mtool.work/python/3.14/library/math.html
- math --- 数学関数 — Python 3.14.8 ドキュメント 8001
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 数値と数学モジュール » math --- 数学関数 テーマ 自動 ライト ダーク | math --- 数学関数 ¶ This module provides access to common math
...。 Number-theoretic functions comb(n, k) Number of ways to choose k items from n items without repetition and without order factorial(n) n の階乗 gcd(*integers) 整数引数の最大公約数 isqrt(n) Integer square root of a nonnegative integer n lcm(*integers) Lea...of the arguments are not integers. Raises ValueError if either of the arguments are negative. Added in version 3.8. math. factorial ( n ) ¶ Return factorial of the nonnegative integer n . バージョン 3.10 で変更: Floats with integral values (like 5.0 ) ar... - https://man.mtool.work/python/3.14/library/math.html