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 7602845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:30:57+00:00 2026-05-30T23:30:57+00:00

x = 16 sqrt = x**(.5) #returns 4 sqrt = x**(1/2) #returns 1 I

  • 0
x = 16

sqrt = x**(.5)  #returns 4
sqrt = x**(1/2) #returns 1

I know I can import math and use sqrt, but I’m looking for an answer to the above. What is integer division in Python 2? This behavior is fixed in Python 3.

  • 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-05-30T23:30:58+00:00Added an answer on May 30, 2026 at 11:30 pm

    In Python 2, sqrt=x**(1/2) does integer division. 1/2 == 0.

    So x(1/2) equals x(0), which is 1.

    It’s not wrong, it’s the right answer to a different question.

    If you want to calculate the square root without an import of the math module, you’ll need to use x**(1.0/2) or x**(1/2.). One of the integers needs to be a floating number.

    Note: this is not the case in Python 3, where 1/2 would be 0.5 and 1//2 would instead be integer division.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was looking over this code to calculate math.sqrt in Java. Why did they
Does anyone know why this always returns False? is_int(sqrt(100)) and what syntax should i
From the Mozilla Developer Network : [1,4,9].map(Math.sqrt) will yield: [1,2,3] Why then does this:
/// I can't do this let max = float n |> sqrt |> int64
I know this question has been asked a lot, but not yet to my
Why is the output of sqrt not an integer for 16 in PHP? Example
I just can't seem to figure out how to make efficient and clean looking
Does anyone know of an alternative for scipy.stats.norm.pdf()? I'm hosting my python site on
I don't know is this right room to ask this question of not. If
I need to use the SQRT function as part of a where clause in

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.