exponentiation | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita


Why in exponentiation it is not giving answer in float? Even when we add two integers the output is in float so then why is it different in this case

22nd Aug 2020, 9:09 AM
Jigisha Chopra
2 Respuestas
+ 2
# your code goes here days = 30 pennys = 0.01 double = pennys*(2**days) print(double) Use this man
9th Mar 2021, 1:24 PM
Rahfi - avatar
+ 1
Arithmetic operators in Python have a rule if either of the operands is float, then the result is a float, otherwise the result is integer: int + int = int int + float = float float + int = float float + float = float
22nd Aug 2020, 10:06 AM
Seb TheS
Seb TheS - avatar