dimanche 1 décembre 2019

Making multiple instances of a Class without manually typing every one in

In the following code, I have made a class that plots a point:

import matplotlib.pyplot as plt
import random 

class Point:
    def __init__(self):
        X = random.randint(0,50)
        Y = random.randint(0,50)

        plt.plot(X, Y,'o')

What I am wondering is that how can you make many instances of this class without manually typing every single one in.




Aucun commentaire:

Enregistrer un commentaire