What is the right answer | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the right answer

9**(1/2) . What is the output 1 or 3....1 in python 2.7....3 in example of solo learning..

31st Oct 2017, 4:23 PM
tetea
tetea - avatar
4 Answers
+ 1
Okay, so 9**1/2 = 9**0.5 = √9 In this scenario, the 0.5 is float value and 9 is integer value. If you declare 0.5 as integer, it will automatically round the number down, so you will be left with 0 (because it will only display a number before a decimal mark) So for example if you have a**b, where b is anything between 0 and 1 and it is saved as an integer, you will always have b = 0, which will make the a**b always 1. Do you understand it better now?
31st Oct 2017, 5:41 PM
imouse
imouse - avatar
0
3. It probably shows 1 because it rounded it down to 9**0 (since it is int)
31st Oct 2017, 5:02 PM
imouse
imouse - avatar
0
I am just a beginner.. I don't Understand yet
31st Oct 2017, 5:14 PM
tetea
tetea - avatar
0
Yeas... Very clear.. Thank you
31st Oct 2017, 5:57 PM
tetea
tetea - avatar