A data challenge a day helps you master machine learning
Hi, please find below:
# DDC-8: Test for Pythagorean triplets
a,b,c = map (int, input ("Please enter the three numbers separated by a space: ").split())
def IsPythagorianTriplet (a,b,c):
if (a**2+b**2 == c**2 ):
return print ("This is a pythagorean triplet")
else:
return print ("The three numbers are not a pythogarean triplet")
IsPythagorianTriplet (a,b,c)
Nice solution, Orith. Although your code assumes the third input is the largest.
Thank you! That's right this is the laid assumption.
Here is mine: https://github.com/hacar864/daily-data-challenge/blob/main/ddc_008_test_for_pythagorean_triplets.ipynb
was fun
Hii,
I loved 😍 your solution!!
Using list comprehension..twice and slicing. Nice!!
Hi,
Thank you very much. But I feel like It's not efficient, idk why.
True. My map () version might be a bit more efficient, but yours is definitely more Pythonic.
I like your approach 👍
Hi, please find below:
# DDC-8: Test for Pythagorean triplets
a,b,c = map (int, input ("Please enter the three numbers separated by a space: ").split())
def IsPythagorianTriplet (a,b,c):
if (a**2+b**2 == c**2 ):
return print ("This is a pythagorean triplet")
else:
return print ("The three numbers are not a pythogarean triplet")
IsPythagorianTriplet (a,b,c)
Nice solution, Orith. Although your code assumes the third input is the largest.
Thank you! That's right this is the laid assumption.
Here is mine: https://github.com/hacar864/daily-data-challenge/blob/main/ddc_008_test_for_pythagorean_triplets.ipynb
was fun
Hii,
I loved 😍 your solution!!
Using list comprehension..twice and slicing. Nice!!
Hi,
Thank you very much. But I feel like It's not efficient, idk why.
True. My map () version might be a bit more efficient, but yours is definitely more Pythonic.
I like your approach 👍