I created a program that works out primes. It was just a test but I thought it would be interesting to then plot this on a graph.
import matplotlib.pyplot as plt
max = int(input("What is your max no?: "))
primeList = []
for x in range(2, max + 1):
isPrime = True
for y in range (2 , int(x ** 0.5) + 1):
if x % y == 0:
isPrime = False
break
if isPrime:
primeList.append(x)
print(primeList)
How can I then plot primeList, can I do it all at once outside of the for loop?

x-axis? You just need to supply x/y pairs in lists of equal length.plt.plot(range(len(primeList)), primeList)for example.