main.py
tests.py
● Python 3
[ ]
import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 2 * np.pi, 200) y = np.sin(x) plt.figure(figsize=(8, 3)) plt.plot(x, y, color='#3b82f6', linewidth=2) plt.title('Sine Wave') plt.show()
[ ]
def count_char(text, char): return sum(1 for c in text if c == char) word = input("Enter a word: ") char = input("Character to count: ") print(f"'{'{'}char{'}'}' appears {'{'}count_char(word, char){'}'} times")
[ ]
def binary_search(arr, target): lo, hi = 0, len(arr) - 1 while lo <= hi: mid = (lo + hi) // 2 if arr[mid] == target: return mid elif arr[mid] < target: lo = mid + 1 else: hi = mid - 1 return -1
Unit Tests
Rubriq