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
Write expression to convert the values 17, len('ab') to (i) integer (ii) str (iii) boolean values
Evaluate and Justify:
(a) 0 or None and "or"
(b) 1 or None and 'a' or 'b'
(c) False and 23
(d) 23 and False
(e) not (1 == 1 and 0 != 1)
(f) "abc" == "Abc" and not (2 == 3 or 3 == 4)
(g) False and 1 == 1 or not True or 1 == 1 and False or 0 == 0
Evaluate and Justify:
(i) 22 / 17 = 37 / 47 + 88 /83
(ii) len('375')**2
Evaluate and Justify:
(i) false and None
(ii) 0 and None
(iii) True and None
(iv) None and None