0
2**4 is 16..ok,but why answer is not comming as 16.0?
11 Answers
+ 2
Because in every programming language it mostly preferred to converts its value to integer format unless and untill some manual creation is not done to the program
Also when the program is compiled its value is send to ram in binary format and then that binary format gets decode and print in the integer format
+ 2
2.0*4.0 is in fact 16.0 .. python doesn't need you to declare things such as integer or double or float. it does a good job handling that for you. when you tell it 2.0 you are telling Python that the number is a float, so when it returns the result, it returns a float
+ 2
first doesn't change anything.
2.0*4 is 8.0
2*4.0 is 8.0
bringing a float into the mix makes the outcome a float
+ 1
The answer for 2.0*4.0 will be 8.0 because compiler get to knows that it is dealing with decimal values so 8.0
+ 1
you can ask, or you can try.. you will learn more that way.
print(2.0**4)
see what it does
+ 1
Yes 2.0**4 will be 16.0
0
ok..what will be an output for 2.0*4.0 and why?
0
ok thanks guys ..
0
ok..then for 2.0**4 will be 16.0 right?
0
2.0**4 because it usually depends upon your first operand of which it consist by that its response is taken
0
ok am cleared ..introducing float will result float ..
Thanks justin and siddharth