KnowledgeBoat Logo
|

Computer Science

Below are seven segments of code, each with a part coloured. Indicate the data type of each coloured 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 ("Freezing")

(ii)

L = ['Hiya', 'Zoya', 'Preet']
print(L[1])

(iii)

M = []
for i in range (3) :
    M.append(i)  
    print(M)      

(iv)

L = ['Hiya', 'Zoya', 'Preet']
n = len(L)
if 'Donald' in L[1 : n] :
     print(L)

(v)

if n % 2 == 0 : 
   print("Freezing")

(vi)

L = inputline.split()
while L != ( ) :
    print(L)
    L = L[1 :]

(vii)

L = ['Hiya', 'Zoya', 'Preet']
print(L[0] + L[1])

Python Funda

31 Likes

Answer

(i) bool
(ii) str
(iii) list of int
(iv) int
(v) bool
(vi) list of str
(vii) str

Answered By

16 Likes


Related Questions