Q. Below are seven segments of code, each with a part colored . Indicate the data type of each colored part by choosing the correct type of data from the following type.
(a) int (b) float (c) bool (d) str (e) function (f) list of int (g) list of str
(i)
if temp
< 32 :
print("Freezirg")
Answer = function
(ii)
L = [ 'Hiya', 'Zoya', Preet' ]
print(L[1])
Answer = str
(iii)
M = [ ]
for i in range (3) :
M. append (i)
print(M)
Answer = list of int
(iv)
L = [ 'Hiya', 'Zoya', 'Preet' ]
n = len (L)
if ‘Donald’ in L[1: n] :
print (L) (i2)
Answer = int
v)
if n% 2 ==
0 :
print("Freezing")
Answer = bool
(vi) L = inputline.split()
while L != ( ) :
print
(L)
L = L[1:]
(vii)
L= [ 'Hiya', Zoya', 'Preet' ]
print (L[0] +
L[1] )
Answer = str
Some answers are wrong
ReplyDeleteNo nothing is wrong . if you found mistake then please tell us .!!!
Delete(i) bool
Delete(ii) str
(iii) list of int
(iv) int
(v) bool
(vi) list of str
(vii) str
Please check the first ans of this question
i) bool
temp < 32 is either false or true so it's answer is bool.
Deleteeverything is right
ReplyDeleteThank you : )
DeleteThank you so much
DeleteAnd everything is right ✓✓✓
Pls explain them
ReplyDeletePlease run it in your IDLE Python and print Data Type of that part of Question.
DeleteHow is n%2==0: a bool value
ReplyDeleteBecause n %2 can give only two output that is True or False.
DeleteYup
DeleteVery useful thanks
ReplyDeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )