Ask coding questions

← Back to all posts
Is there anyway to make this code smaller?
MisledWater79 (0)

I can’t figure out if I can make this smaller and do the same thing.

Answered by btfuss (177) [earned 5 cycles]
View Answer
Comments
hotnewtop
MisledWater79 (0)

@btfuss I was able to make it even small with your code’s help! I used the 1: and it worked! Thanks a lot! Also here is the new code I made:

alpha = 'abcdefghijklmnopqrstuvwxyz'

for i in alpha:
  print(alpha)
  alpha += alpha[0]
  alpha = alpha[1:]
19ecal (232)
a=[chr(i) for i in range(97,123)]
a0=[chr(i) for i in range(97,123)]
num=0
for i in a0:
	print(" ".join(a))
	a=a[1:]
	a.append(a0[num])
	num+=1