Aug-02-2019, 11:05 AM
Hi guys!
I got problem with my code. I wish in everytime new numbers from "Randomi" give it to class "data". After that write in row in array "arr" in order x,y,r,g,b.
So problem is with defind tha x,y,r,b,g (i know i defind in class and give numbers in randomi but in main nothing happ ). Ty for your help!
I got problem with my code. I wish in everytime new numbers from "Randomi" give it to class "data". After that write in row in array "arr" in order x,y,r,g,b.
So problem is with defind tha x,y,r,b,g (i know i defind in class and give numbers in randomi but in main nothing happ ). Ty for your help!
import random import numpy as np arr = np.empty((1, 5), dtype=object) class data: def __init__(self, x,y,r,g,b): self.x=rx self.y=ry self.r=rr self.g=rg self.b=rb def Randomi(): for i in range(5): rrr=random.randint(0,100) rx=ry=rr=rg=rb=rrr def main(): Randomi() p=data(x,y,r,g,b) for character in 'xyRGB': print(character) for i in range (0,5): arr [0,i]=p.character print(arr) if __name__ == "__main__": main()