Python Help

3 comments:

  1. Replies
    1. This comment has been removed by the author.

      Delete
    2. squares = []
      square_pair = []
      pythagorian_triples = []

      for i in range(1, 101):
      squares.append(i**2)
      for j in range(i, 101):
      if i != j:
      square_pair.append( (i**2, j**2) )

      for z in squares:
      for (x,y) in square_pair:
      if z == x+y:
      pythagorian_triples.append( ( round(x**0.5), round(y**0.5), round(z**0.5) ) )

      print()

      print("Pythagorian triples upto 100 are : ", pythagorian_triples)

      print()

      print("There are ",len(pythagorian_triples)," triples")

      print()

      Delete