Python3: How can I make a function that evaluates all the three possible numbers between 1and500 that fulfils PythagorasTheorem? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python3: How can I make a function that evaluates all the three possible numbers between 1and500 that fulfils PythagorasTheorem?

10th Mar 2019, 5:12 AM
Gabriel Gonzalez
Gabriel Gonzalez - avatar
6 Answers
+ 2
Iterate A from 1to250, B from A to 500 in nested loops. Check if C is integer and less than 501.
10th Mar 2019, 8:13 PM
tamaslud
tamaslud - avatar
+ 1
Gabriel Gonzalez If you want to add all 500 consequent numbers to the list you can easyly do it. One way is: lst = list(range(1, 501)) There is a fine Python tutorial on SoloLearn: https://www.sololearn.com/learn/Python/2434/
10th Mar 2019, 6:34 AM
portpass
0
What have you tried so far?
10th Mar 2019, 5:16 AM
Diego
Diego - avatar
0
Diego Diego I was thinking about using a List but it'll be hard to write all 500 numbers on the list (I don't know if there is a way to include them all in the list without actually typing each one of them), and then, I don't know how can I evaluate all the three number combinations (there are like thousands of them)
10th Mar 2019, 5:41 AM
Gabriel Gonzalez
Gabriel Gonzalez - avatar
0
Diego I'm new in Python, I'm just starting to learn some things, right know I just know how to use While loops, if sentences, try excepts, and a couple of other things
10th Mar 2019, 5:44 AM
Gabriel Gonzalez
Gabriel Gonzalez - avatar
0
portpass thanks!
10th Mar 2019, 2:50 PM
Gabriel Gonzalez
Gabriel Gonzalez - avatar