0
Why 2+5=7 not 7.0?
7 Answers
+ 3
data type of both inputs are integer so the output will be an interger
+ 3
try 2.0+5
or 2+5.0
and see what happens :)
+ 3
In programming language 7 and 7.0 are two different thing. 7 is an integer value and 7.0 is a float value. The plus + operator returns value based on the input. It works like this.
int + int = int 2 + 5 = 7
int + float = float 2 + 5.0 = 7.0
float + int = float 2.0 + 5 = 7.0
float + float = float 2.0 + 5.0 = 7.0
float can contain integer numbers but integer can not contain float numbers. so most of the conditions returns float. But at least one of the inputs must be float.
+ 3
Thanx for the like. :)
+ 1
using + on ints return another int
0
They are both integers. You need a float.
0
Python is a loosely typed language, once you involve division in your code. Automatically the answer we'll have a precision or decimal value