Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9106753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:24:46+00:00 2026-06-17T02:24:46+00:00

I’m new to python and struggling quite a bit to get this going. This

  • 0

I’m new to python and struggling quite a bit to get this going.
This is my task:

The Six-Letter Cipher is a method of encoding a secret message that
involves both substitution and transposition. The encryption starts by
randomly filling a 6  6 grid with the alphabet letters from A to Z
and the digits from 0 to 9 (36 symbols in total). This grid must be
known to both the sender and receiver of the message. The rows and
columns of the grid are labelled with the letters A, B, C, D, E, F.

Write a Python program that implements the six-letter cipher method.
Your program should:
1. Create a 6×6 grid and fill it randomly with letters and numbers as described in the first paragraph, then prompt the user to enter a
secret message.
2. Display the 6×6 grid and the generated ciphertext, after the user enters the secret message.
3. Prompt the user to enter the ciphertext to display the original message. It is OK to ask the user to separate every two letters of the
ciphertext with a space or comma.

The bit I am struggling with is how do I search through the nested lists for the randomly placed letter that has been entered and give the coordinates. Also won’t the coordinates be given in numbers i.e. 0,1, rather than letters i.e. A,B
I think I could manage the encoding and decoding once I have the ideas of how to use this nested list.

Here is my code so far:

grid = [["Z","9","G","Q","T","3"],
    ["Y","8","F","P","S","2"],
    ["X","7","E","O","R","1"],
    ["W","6","D","N","M","0"],
    ["V","5","C","L","K","U"],
    ["J","4","B","I","H","A"]]

def main():
    print("Welcome to the sixth cipher")
    print("Would you like to (E)Encode or (D)Decode a message?")
    operation = input()

    if(operation == "E"):
        encodecipher()
    elif(operation == "D"):
        decodecipher()
    else:
        print("Sorry, input not recognised")

def encodecipher():
    print("Please enter a message to encode:")
    messagetoencode = input()



def decodecipher():
    print("Decode Test")
    rowcolumn()


def rowcolumn():
    pass

main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:24:47+00:00Added an answer on June 17, 2026 at 2:24 am

    You can use Python’s enumerate to iterate over values and provide an index position of each value as you go:

    grid = [["Z","9","G","Q","T","3"],
        ["Y","8","F","P","S","2"],
        ["X","7","E","O","R","1"],
        ["W","6","D","N","M","0"],
        ["V","5","C","L","K","U"],
        ["J","4","B","I","H","A"]]
    
    search = 'D'
    
    for rownum, row in enumerate(grid):
        for colnum, value in enumerate(row):
           if value == search:
               print "Found value at (%d,%d)" % (rownum, colnum)
    

    You can adapt this into your chosen function structure, such as the following (if values in your grid are unique):

    def findvalue(grid, value):
        for rownum, row in enumerate(grid):
            for colnum, itemvalue in enumerate(row):
                if itemvalue == value:
                    return (rownum, colnum)
        raise ValueError("Value not found in grid")
    

    As this will raise a ValueError if the value isn’t found, you’ll have to handle this in your calling code.

    If you then need to map between 0-indexed row and column numbers to the letters A…F you can do something like:

    def numbertoletter(number):
        if number >= 0 and number <= 26:
            return chr(65 + number)
        else:
            raise ValueError('Number out of range')
    

    Which will give you the following:

    >>> numbertoletter(0)
    'A'
    >>> numbertoletter(1)
    'B'
    

    Putting it all together gives you:

    value = 'B'
    row, col = map(numbertoletter, findvalue(grid, value))
    print "Value '%s' found at location (%s, %s)" % (value, row, col)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.