I have a string encryption algorithm which converts a inputted string into list of string . The output is supposed to be the first letter of every list element(string here). example in the list1 below
output is supposed to be 'tir hsy ia st' and list2 output should be 'tir hsy iat sto'
But with the code i'm having it is able to print the output only if every list element(string here) contains same number of letters otherwise(in case of list 1) it raises "string index out of range".
The ceil here indicates the number of letters in each list element.(4 here in this case)
How do i go about printing the output of list1 in the way shown? p.s-i'm beginner in python
list1=['this','isat','ry']
list2=['this','isat','ryto']
my code to print the output
for elem in range(ceil):
for i in range(len(list1)):
if list1[elem][i]:
print(list1[i][elem],end='')
print(end=' ')