import matplotlib.pyplot as plt
import time
def timer(func):
def wrapper(*args, **kwargs):
before = time.time()
result = func(*args, **kwargs)
print('Function took:', time.time() - before, " seconds")
return result
return wrapper
@timer
def pattern_1(end_value):
start = 1
xs = []
ys = []
for val in range(start, end_value + 1):
if val > 1:
for n in range(2, val):
if (val % n) == 0:
break
else:
xs.append(val)
ys.append(val)
fig = plt.figure(figsize=(15, 15))
plt.polar(xs, ys, 'g.')
ax = plt.gca()
pattern_1(100)
plt.show()
{ 0 comments… add one }
Next post: Building Calculator using PyQt6 in Python
Previous post: QtFIGLet…