What is the output of the following program?
Python
tup = (1, 2, 3, 4)
tup.append( (5, 6, 7) )
print(len(tup))
What is the output of the following program?
Python
tup = {}
tup[(1,2,4)] = 8
tup[(4,2,1)] = 10
tup[(1,2)] = 12
sum1 = 0
for k in tup:
sum1 += tup[k]
print(len(tup) + sum1)
What is the output of the following program?
Python
tup1 = (1, 2, 4, 3)
tup2 = (1, 2, 3, 4)
print(tup1 < tup2)
What is the output of the following program?
Python
tup = (1, 2, 3)
print(2 * tup)
What is the output of the following program?
Python
tup=("Check")*3
print(tup)
What is the output of the following program?
Python
s = 'geeks'
a, b, c, d, e = s
b = c = '*'
s = (a, b, c, d, e)
print(s)
(‘g’, ‘*’, ‘*’, ‘k’, ‘s’)
(‘g’, ‘e’, ‘e’, ‘k’, ‘s’)
What is the output of the following program?
Python
tup = (2e-04, True, False, 8, 1.001, True)
val = 0
for x in tup:
val += int(x)
print(val)
What is the output of the following program?
Python
li = [3, 1, 2, 4]
tup = ('A', 'b', 'c', 'd')
li.sort()
counter = 0
for x in tup:
li[counter] += int(x)
counter += 1
break
print(li)
What is the output of the following program?
Python
li = [2e-04, 'a', False, 87]
tup = (6.22, 'boy', True, 554)
for i in range(len(li)):
if li[i]:
li[i] = li[i] + tup[i]
else:
tup[i] = li[i] + li[i]
break
[6.222e-04, ‘aboy’, True, 641]
[6.2202, ‘aboy’, False, 87]
What is the output of the following program?
Python
import sys
tup = tuple()
print(sys.getsizeof(tup), end = " ")
tup = (1, 2)
print(sys.getsizeof(tup), end = " ")
tup = (1, 3, (4, 5))
print(sys.getsizeof(tup), end = " ")
tup = (1, 2, 3, 4, 5, [3, 4], 'p', '8', 9.777, (1, 3))
print(sys.getsizeof(tup))
There are 11 questions to complete.
Take a part in the ongoing discussion
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4