DEVCHAMPION

Diagonal count

PYTHON CHALLENGE

The points (whose coordinates are natural numbers) are numbered from 1 by following the diagonals, as shown in the figure below:

  • Write a first program (saved in a file named NumVersCoord.py) which requires a strictly positive integer n, and which returns the coordinates of the point bearing the number n. For example, a user who enters “33” will see the display The point numbered 33 has coordinates (4; 3).
  • Write a second program (saved in a file named CoordVersNum.py) which requests two positive integers x, y, and which returns the number of the coordinate point (x; y). For example, a user who enters the two numbers “4.3” will see the display The coordinate point (4; 3) is the number 33.

To be sure the program works, answer the two questions below:

  1. What are the coordinates of the point numbered 2012? →
  2.  What is the coordinate point number (2703; 2012)? →

SUB HEADING

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incidi. Lorem ipsum dolor sit amet, consectet dolor sit amet, consectetur adipiscing elit