+ 2

In python. print ( 9 * * ( 1/ 2 ) ) = 3.0

Can anyone explain or iterate this... Please

7th Dec 2022, 6:54 AM
Chandana M
Chandana M - avatar
4 Answers
+ 7
Chandana M You used back slash instead of divisor operator print (9**(1/2)) Will give 3.0 as output
7th Dec 2022, 7:21 AM
Riya
Riya - avatar
+ 11
'**' is the exponentiation operator 9**(1/2) is basically the square root of 9 Since 1/2=0.5, 9**0.5=3.0 (since exponent is a float, the output is a float)
7th Dec 2022, 8:15 AM
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬
šŸ‘‘ Prometheus šŸ‡øšŸ‡¬ - avatar
+ 5
The correct syntax would be: print(9 ** (1/2)) Here, the ** operator is used to calculate the power of a number. In this case, the number 9 is being raised to the power of 1/2, which is the same as taking the square root of 9. The print() function is then used to print the result to the screen. The result of this code would be 3.0, which is the square root of 9. I hope this helps! Let me know if you have any other questions.
7th Dec 2022, 9:52 AM
CalviÕ²
CalviÕ² - avatar
+ 3
Okay Ria... But I want how it gonna work
7th Dec 2022, 7:31 AM
Chandana M
Chandana M - avatar