Which of the following statements is true about patterns in Python?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
Which of the following statements is true about number patterns in Python?
What is the output of the following code?
for i in range(5):
print('*' * i)
What is the output of the following code?
for i in range(5, 0, -1):
print(str(i) * i)
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + str(i) * i)
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + '* ' * i)
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + chr(64 + i) * i)
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + ' '.join(str(j) for j in range(1, i + 1)))
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + ' '.join(str(j) for j in range(i, 0, -1)))
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + ' '.join(str(j) for j in range(i, 0, -1)) + ' '.join(str(j) for j in range(2, i + 1)))
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + ' '.join(str(j) for j in range(i, 0, -1)) + ' '.join(str(j) for j in range(i - 1, 0, -1)))
What is the output of the following code?
for i in range(1, 6):
print(' ' * (5 - i) + ' '.join(str(j) for j in range(i, 0, -1)) + ' '.join(str(j) for j in range(i - 1, 0, -1)) + ' '.join(str(j) for j in range(2, i + 1)))