Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nuitka-standalone-executable/cpu_benchmark.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import math
import time

start = time.perf_counter()
total = 0.0
for i in range(20_000_000):
total += math.sqrt(i)
elapsed = time.perf_counter() - start

print(f"Result: {total}")
print(f"Time: {elapsed:.3f}s")
5 changes: 5 additions & 0 deletions nuitka-standalone-executable/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Python is a popular programming language. Python is easy to learn, and Python
is also powerful enough for real projects. Many developers choose Python for
web development, data science, and automation. Python code is often easy to
read, which is one reason Python remains popular among beginners and
experienced developers alike.
12 changes: 12 additions & 0 deletions nuitka-standalone-executable/wordcount.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from argparse import ArgumentParser
from collections import Counter
from pathlib import Path

parser = ArgumentParser(description="Show the most common words in a text file.")
parser.add_argument("file", type=Path)
parser.add_argument("-n", "--top", type=int, default=5)
args = parser.parse_args()

words = args.file.read_text(encoding="utf-8").lower().split()
for word, count in Counter(words).most_common(args.top):
print(f"{word}: {count}")
Loading