I’m trying to build a method that takes in a string, and returns the previous letters of the string. For example, “abc” would return “zab”
This is what I have so far:
def decrypt(string)
index = 0
alphabet = “abcdefghijklmopqrstuvqxyz”
while index < string.length
if string[index] == " "
puts string[index] = " "
else
puts
end
index += 1
end
end
actually, i looked more into this, and ruby might be a good language to do this in.
This isn’t actually a beginner problem, and i don’t know that there is an easy way to go through this, but i found some other examples of people writing caesar ciphers in ruby, and you could actually do a list of something like:
l_alphabet = ("a".."z").to_a
I don’t know if this gives you a sort of idea for what you could use an index for .
I could direct you to examples of caesar ciphers, but i don’t know if that might be cheating.
Are you doing this for fun/experience or for something else?