0
Data type assignment
def print_sum_twice(x, y, z): print(x + y) print(x - y) print((x*y)/z) print_sum_twice(5, 8, 20) when the above block of code is ran, it prints out an int for the first two times and a float for the last one, how does python know when to treat the number as an int or a float?
1 Answer
+ 3
The result of a division with / is a float. If you want the euclidian division, use //.