I'm trying to find, using dictionaries:
Using two while loops, nested, create a dictionary whose keys are the sum of two cubes. That is iterate through all pairs i and j, calculating i^3+j^3 until it gets too large.
2.Whenever you calculate a new i^3+j^3, check and see if there is already an entry for it.
3.If so, you have found a new pair of numbers the sum of whose cubes, because there is already a pair of number that cube and sum to the same value.
Here is my code: please help me figure what is wrong with my code.
dit = dict()
j = 1
i = 1
while i < 10:
while j < 10:
summ = i**3+ j**3
if summ in dit:
print(summ, (i,j), dit.get(summ))
else:
dit [summ] = (i,j)
j = j +1
print(dit)
j = 2
i = i + 1