+ 1

so do all your maths answer have to have a decimal point in python 3.5 ?

so do all your maths answer have to have a decimal point in python 3.5 ?

10th Sep 2019, 6:39 AM
pieterdeklerk
4 odpowiedzi
+ 2
Need not to be..
10th Sep 2019, 8:55 AM
Kuri
Kuri - avatar
+ 2
Floor division - // will not have decimal part. It is also called Integer Division.
11th Sep 2019, 5:21 AM
Kuri
Kuri - avatar
0
Yes, but I think it is a feature. If you do numb= 3 # which is type int divisor = 2 # type is also int print(numb/divisor) Result is >>>1.5 # is float The true result is type float. if you do numb = 3 # which is type int divi = 2 # type is also int print(int(numb/divi)) Result is >>>1 with int(somenumber) you convert it (and force it) to int But the result is false. You can force a int, but the price is a false result. If you do nothing, Python do this step (convert into float) for you. If you do numb= 2 # which is type int divis= 2 print(numb/divis) Result is float 1.0 # type is float
10th Sep 2019, 6:16 PM
Sven_m
Sven_m - avatar
0
https://code.sololearn.com/cN64fQoszouP/#cpp Support my code about maths here, please upvote
27th Sep 2019, 3:23 PM
tho.tran.#
tho.tran.# - avatar