> > Hello guys. so my assignment consists in creating a key generator so i can 
> > use it in later steps of my work. In my first step i have to write a 
> > function called key_generator that receives an argument, letters, that 
> > consists in a tuple of 25 caracters. The function returns a tuple of 5 
> > tuples of caracters, each tuple with 5 elements.
> >  Sounds confusing right? well I have the final product but i dont know how 
> > to get there. I was told by my professor that I dont really have to use any 
> > complicated knowledge of python so I have to keep it simple. Can u help me 
> > plz? just give me a hint how to do it and i'll do everything plz.
> >
> > example:
> > Python Shell
> >
> >>>> letters = (‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, \
> > ... ‘H’, ‘I’, ‘J’, ‘ ’, ‘L’, ‘M’, ‘N’, \
> > ... ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, \
> > ... ‘V’, ‘X’, ‘Z’, ‘.’)
> >>>> key_generator(letters)
> > ... ((‘A’, ‘B’, ‘C’, ‘D’, ‘E’),
> > ... (‘F’, ‘G’, ‘H’, ‘I’, ‘J’),
> > ... (‘ ’, ‘L’, ‘M’, ‘N’, ‘O’),
> > ... (‘P’, ‘Q’, ‘R’, ‘S’, ‘T’),
> > ... (‘U’, ‘V’, ‘X’, ‘Z’, ‘.’))
> Start by playing with letters in the shell and seeing what you can do
> with it.  The word you're looking for is 'slices'.  Figure out
> interactively what you need to do, then write it up.

I would a assume a key generator to be random so this may help.

Also about tuples

* from the link
Of course, even if we can’t modify the elements of a tuple, we can always make 
the julia variable reference a new tuple holding different information. To 
construct the new tuple, it is convenient that we can slice parts of the old 
tuple and join up the bits to make the new tuple. So if julia has a new recent 
film, we could change her variable to reference a new tuple that used some 
information from the old one:

>>> julia = julia[:3] + ("Eat Pray Love", 2010) + julia[5:]
>>> julia
("Julia", "Roberts", 1967, "Eat Pray Love", 2010, "Actress", "Atlanta, Georgia")


Reply via email to