+ 26
[🏆 CHALLENGE 🏆]:: TYPEOF QUAD ⬛⬜🔢
Challenge #4 Let's do some geometry this time. The challenge is to write a code which takes 4 pairs of XY coordinates and tell if the quad made by joining them is a square, rect, parallelogram, rhombus, trapezium, kite or none of them. You can use any algorithm. Test cases: (-1,0),(1,2),(2,1),(0,-1)->Rect (-1,0),(0,2),(1,0),(0,-2)->Rhombus (0,1),(1,2),(2,1),(1,0)->Square (0,0),(0,2),(3,3),(2,0)->Kite Good luck.👍 All languages allowed. Happy Coding 😀. At least try to participate.😀
14 odpowiedzi
+ 5
https://code.sololearn.com/cm2PS6WN6hwp/?ref=app
Coming soon, extracted all useful info so far
+ 17
yes @Pegasus
@Calvin Thanks
+ 16
@Brains can you explain your idea in detail?😀
+ 13
@Pegasus Test case 4 is a kite.
In your code, it has to be kite if lengths[0]==lengths[1] that is false in that case but lengths[1]==lengths[2] and lengths[0]==lengths[3]. So there's more work to be done. 😀
Nice code by the way.
Good luck.👍
+ 12
Hello everyone.
Thanks for participating in this challenge.
Hope you like the next one in this series also:
https://www.sololearn.com/discuss/993834/?ref=app
+ 9
So some quadrilaterals are:
Square
Rectangle
Rhombus (or diamond)
Parallelogram
Trapezium
Kite
Will this do?
+ 9
Another great challenge task. @Swapnil 👍🏼
ps.
@Pegasus
I like your mod badge. Congrats.
+ 8
An interactive solution, have fun 😊😊😊
https://code.sololearn.com/Wft535TH6VA2/
+ 7
would be more fun if more than four coordinates where allowed
+ 4
@Swapnil but the other 2 lengths are not equal. A kite must have 2 pairs of equal lengths
+ 3
@Pegasus, (0,2)->(3,3) and (3,3)->(2,0) are equal, (0,0)->(0,2) and (2,0)->(0,0) are equal. 2pairs of equal length.
+ 2
@Pegasus good code ya