Here is one function from my code
def seq():
q=1
n=rann()
List=[n]
while q<n:
if (n % 2):
n = 3*n + 1
List.append(n)
else:
n=n//2
List.append(n)
if (len(List)>=len(y)):
print(List)
else:
return(rann())
x=input("enter name") #the next four lines of the code are my first trial.
y= [char for char in x]
for i in y:
y[i]=rann()
seq()
I have two functions, the 1st function, rann(), generates an integer and the other(the code above) generates a sequence based on that number. I wanted to take an input x and replace every character with the sequence generated. I tried doing this
text = 'bat ball'
y=[char for char in text]
y[0:] = rann()
print(y)
For example let the input be "bat ball" so what I wanted was to replace every character of the input by every term of the sequence. I know there is a lot of things wrong But I can't figure out another method.
You mean like this? I contrived a
rann(x)to generate the ascii code value of the characterx, but you get the idea.