Computer Science

Evaluate and Justify:

(i) 22.0/7.0 - 22/7

(ii) 22.0/7.0 - int(22.0/7.0)

(iii) 22/7 - int (22.0)/7

Python Data Handling

22 Likes

Answer

(i) 22.0/7.0 - 22/7
 ⇒ 0

As values of 22.0/7.0 and 22/7 are equal, subtracting them will give the result as 0.0.

(ii) 22.0/7.0 - int(22.0/7.0)
 ⇒ 3.142857142857143 - 3
 ⇒ 0.142857142857143

(iii) 22/7 - int (22.0)/7
 ⇒ 0.0

int (22.0) gives 22 so the expression becomes 22/7 - 22/7 which results in 0.0

Answered By

14 Likes


Related Questions