ProgrammingModerateTCS NQT · Wipro pattern
What is printed?
What is printed?
print('Python' * 0 + 'x', 'Py' + 'thon' * 0, len('' * 100))- A. x Python 0
- B. x Py 1
- C. x Py 0
- D. xpy 0
Correct answer: C. x Py 0
Repeating a string zero times gives the empty string, so the first value is just x. Likewise 'thon' * 0 adds nothing, and the empty string repeated stays empty.
More Python Programming questions
- What is printed? python print(len(str(2100)), str(2100)[-3:], (2100) % 1000)
- What is printed? python x = 5 x += 2 x print(x, x - 2 3 2 // 9 1, x // 4 4 + x % 4)
- What is printed? python print([i for i in range(10) if i % 3 == 0][::-1], [i i for i in range(5)][-2:], len([]) == 0)
- What is printed? python print('%.2f' % 1.255, '%.2f' % 1.245, '%.1f' % 0.05, '%.1f' % 0.15)
- What is printed? python print(str(1e-4), str(1e-5), str(123456789.0), str(1234567890123456789.0))
- What is printed? python print(18 // 4 if False else 'na', 'na' 2 + 'ba')