2から100までの間にある素数を、カンマで区切って、全て表示する。
import math def prime(k): if k <= 1: return False for i in range(2, int(math.sqrt(k)) + 1): if k % i == 0: return False return True def primes(n): for i in range(2, n + 1): if prime(i): print(i, end=',') primes(100)
Generation
2から100までの間にある素数を、カンマで区切って、全て表示する。
import math def prime(k): if k <= 1: return False for i in range(2, int(math.sqrt(k)) + 1): if k % i == 0: return False return True def primes(n): for i in range(2, n + 1): if prime(i): print(i, end=',') primes(100)
Generate
More than just a code generator. A tool that helps you with a wide range of tasks. All in one place.
Function from Description
Text Description to SQL Command
Translate Languages
Generate HTML from Description
Code to Explanation
Fix invalid Code
Get Test for Code
Class from Description
Regex from Description
Regex to Explanation
Git Command from Description
Linux Command
Function from Docstring
Add typing to code
Get Language from Code
Time complexity
CSS from Description
Meta Tags from Description