Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:32:46+00:00 2026-06-15T03:32:46+00:00

My task is to calculate the distance between a rectangle and the 0/0 point

  • 0

My task is to calculate the distance between a rectangle and the 0/0 point in an coordinate system and print a particular answer. If it’s nearer than 100m (the unit of the system is meters, 1 unit = 1 meter), it should print 100m, if distance < 200m, print 101m…

I’ve learned that I can use the Pythagorean theorem to get the distance between two coordinates. I implemented it into my program (in Python) but I have got some trouble with the output.

Let’s try an example. A rectangle with the coordinates (–400,200); (–300, 200); (–300, 300); (–400, 300) is 360m away from the point (0/0). The right output would be “103m”.

Somebody asked something like this before and they said, you have to divide the distance through 100 and add it to “10{}”.

print("10{}m".format(distance//100))

Actually, this works for everything below 1000. If the coordinates would be (–4000,2000); (–3000, 2000); (–3000, 3000); (–4000, 3000), the correct distance would be “3605m” and it should output “136m”.

Hope you can understand my case/question!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:32:47+00:00Added an answer on June 15, 2026 at 3:32 am
    print("{:d}m".format(100+(distance//100)))
    

    For example,

    In [16]: distance = 50; "{:d}m".format(100+(distance//100))
    Out[16]: '100m'
    
    In [17]: distance = 360; "{:d}m".format(100+(distance//100))
    Out[17]: '103m'
    
    In [18]: distance = 3605; "{:d}m".format(100+(distance//100))
    Out[18]: '136m'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been given a task to calculate the number of days between 2
I'd like to calculate a path in a MsBuild task, to be used by
I am stuck solving a task requiring me to calculate the minimal number of
Seems, it's common task, but I haven't found solution. I need to calculate number
Task: To provide facility to upgrade the system remotely or add new features. What
I have a task - calculate 6 results of function (Y = (20 *
My task is to create a function which should calculate the arcsin for my
I am currently doing a task in a book which asks me to calculate
I am trying to calculate the percent change between two points in R in
Main purpose of this task is to calculate volumes and surface areas of three

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.