Logo

Programming-Idioms

History of Idiom 179 > diff from v7 to v8

Edit summary for version 8 by random:
New Python implementation by user [random]

Version 7

2019-03-19, 16:53:48

Version 8

2019-09-26, 13:33:57

Idiom #179 Get center of a rectangle

Return the center c of the rectangle with coördinates(x1,y1,x2,y2)

Idiom #179 Get center of a rectangle

Return the center c of the rectangle with coördinates(x1,y1,x2,y2)

Code
center = ((x1+x2)/2, (y1+y2)/2)
Comments bubble
center is a tuple that can be accessed using index 0 for x and 1 for y.

e.g. center[0]