Question is so easy we’re going to solve it with the loop 🤪 #coding #computerscience #stem #python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

_=[print(*list(range(1, 11)[i*(i+1)//2:(i*(i+1)//2)+(i+1)]) for i in range(4)]

Cursed one-liner gang 😁

tealkine
Автор

n=int(input())
c=0
for i in range(1, n+1):
k=0
while(k<i):
c+=1
print(c, end=' ')
k+=1
print()

uniqueuday
Автор

most understandable i whipped up in a min

s, e = 1, 1
for i in range(n):
print(' '.join(map(str, range(s, e + 1))
s = e + 1
e += i + 2

hallooww
Автор

def floydsTriangle():
row, count = 4, 1

for i in range(row):
print(*range(count, count+i+1))
count += i+1

floydsTriangle():

Aadoxide
Автор

Tried the same code as it is explained but getting as "1 2 3 4 5 6 7 8 9 10" in one line not as triangle. Can someone try and explain this where I am going wrong.

mutthuaravind
Автор

can you solve the same problem using javascript?

iiiyadex
Автор

Literally would have been shorter and more efficient just to print the 4 lines using hardcoded strings.

montyyoutube
Автор

def floyd_triangle():
print("\n".join([" ".join(map(str, range(i, i*i+1, i)))for i in range(1, 5)]))

Rain
welcome to shbcf.ru