What will be the output of the following Python code?
int(‘65.43’) a) ImportError b) ValueError c) TypeError d) NameError
Python programming language
int(‘65.43’) a) ImportError b) ValueError c) TypeError d) NameError
4 + ‘3’ a) NameError b) IndexError c) ValueError d) TypeError
t[5] a) IndexError b) NameError c) TypeError d) ValeError
lst = [1, 2, 3] lst[3] a) NameError b) ValueError c) IndexError d) TypeError
a=False while not a: try: f_n = input(“Enter file name”) i_f = open(f_n, ‘r’) except: print(“Input file not found”) a) No error b) Assertion error c) Input output error d) Name error
g = (i for i in range(5)) type(g) a) class <’loop’> b) class <‘iteration’> c) class <’range’> d) class <’generator’>
a) try b) except c) accept d) finally
a) try b) except c) accept d) finally
import itertools l1=(1, 2, 3) l2=[4, 5, 6] l=itertools.chain(l1, l2) print(next(l1)) a) ‘list’ object is not iterator b) ‘tuple’ object is not iterator c) ‘list’ object is iterator d) ‘tuple’ object is iterator
def f(x): for i in range(5): yield i g=f(8) print(list(g)) a) [0, 1, 2, 3, 4] b) [1, 2, 3, 4, 5, 6, 7, 8] c) [1, 2, 3, 4, 5] d) [0, 1, 2, 3, 4, 5, 6, 7]