exponentiation | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

exponentiation

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 Réponses
+ 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
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