I am looking for a way to get a cartesian product of a string in the following form,
text = 'school'
I want the result like this,
list_ = [(s,c),(c,h),(h,o),(o,o),(o,l)]
this is what I tried,
text = 'school'
list_=[]
for i in range(len(text)):
while i < len(text)+1:
print(text[i], text[i+1])
list_.append((text[i], text[i+1]))
i = i+1
I got the necessary list, yet throwing off some errors. Is there any elegant way to do this?