Computer Science
What will the result given by the following?
(a) type (6 + 3)
(b) type (6 -3)
(c) type (6 *3)
(d) type (6 / 3)
(e) type (6 // 3)
(f) type (6 % 3)
Answer
(a) type (6 + 3)
⇒ int + int
⇒ int
So the result is int.
(b) type (6 -3)
⇒ int - int
⇒ int
So the result is int.
(c) type (6 * 3)
⇒ int * int
⇒ int
So the result is int.
(d) type (6 / 3)
⇒ int / int
⇒ float
So the result is float.
(e) type (6 // 3)
⇒ int // int
⇒ int
So the result is int.
(f) type (6 % 3)
⇒ int % int
⇒ int
So the result is int.
Related Questions
Differentiate between (555/222)**2 and (555.0/222)**2.
What are augmented assignment operators? How are they useful?
If you give the following for str1 = "Hello", why does Python report error?
str1[2] = 'p'
Given str1 = "Hello", what will be the values of:
(a) str1[0]
(b) str1[1]
(c) str1[-5]
(d) str1[-4]
(e) str1[5]