My given instructions: Write a program that continually generates 2 numbers between -5 and 5. After each number is generated, display each pair from smallest to biggest along with the sum of the pair. The program stops when the program generates a pair that is the negative of the other (for example, -5 and 5 or -2 and 2) At the end of the program display the sum of all the numbers that were generated.
Here's my code: My problem is I don't know how to display each pair from smallest to biggest along with the sum of the pair. I also am not sure about displaying the sum of all the numbers that were generated.
`
import random
i = 0
while i < 1:
number1= random.randint(-5,5)
number2= random.randint(-5,5)
print("(", number1, ",", number2, ")")
if number1 == -number2:
break
if number2 == -number1:
break
`
I think my code below is self-explanatory. yet if you had any doubts or questions, I'm happy to explain