Feb-16-2019, 11:25 AM
You don't need the for loops when you generate x and y. With your code you will generate 11 x values and 29 y values, but at the end you will add just the last pair - 11th x and 29th y, all other are lost. see for yourself
when you get the x and y, you don't want to add them to list. you want to create instance of Triangle or Sphere class and use x and y when create that instance
the second snippet - it even doesn't run. Please, pay more attention.
a=[] for j in range(11): x=random.randint(1,12) print('x={}'.format(x)) for i in range(29): y=random.randint(1,29) print('y={}'.format(y)) a.append((x,y)) print(a)note that you need extra pair of brackets for the append.
when you get the x and y, you don't want to add them to list. you want to create instance of Triangle or Sphere class and use x and y when create that instance
the second snippet - it even doesn't run. Please, pay more attention.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs