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 6669437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:08:59+00:00 2026-05-26T03:08:59+00:00

I need to convert a string of numbers into a string of letters to

  • 0

I need to convert a string of numbers into a string of letters to form words
Example:
if the input to your program is
1920012532082114071825463219200125320615151209190846 it should return
stay hungry. stay foolish.

I have this so far:

def number ():
output = []
input = raw_input ("please enter a string of numbers: ")
for number in input:
    if number <= 26:
        character = chr(int(number+96))
        output.append(character)
    else:
        character = chr(int(number))
        output.append(character)
print output

I need it to somehow determine that every two numbers equals one letter.
I have a program that does the reverse of this, outputs numbers when given letter. this is what that looks like:

def word ():
output = []
input = raw_input("please enter a string of lowercase characters: ")
for character in input:
    number = ord(character) - 96
    if number > 0:
        if number <= 9:
            output.append('0' + str(number))
        else:
            output.append(str(number))
    else:
        output.append(str(number + 96))
print ''.join(output)

Thanks for the help

  • 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-05-26T03:08:59+00:00Added an answer on May 26, 2026 at 3:08 am

    You can split up the str into two-character chunks using zip() and slicing with a step like this:

    for pair in zip(input[::2], input[1::2]):
        number = "".join(pair)
    

    I’d write the whole thing like this:

    def int_str_to_chr_str(int_str):
        res = []
        for pair in zip(int_str[::2], int_str[1::2]):
            number = int("".join(pair))
    
            if number <= 26:
                number += 96
    
            res.append(chr(number))
    
        return "".join(res)
    
    print int_str_to_chr_str("1920012532082114071825463219200125320615151209190846")
    

    It’s more useful to have the logic separated from input and output, so you can use the function in other parts of a program. It’s also a good idea to avoid repeating the use of names like number or input (which is a built-in).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

edited everything I need to convert words into binary numbers. With a bit help
I need convert some Mac Numbers(00163e2fbab7) into Mac String. (with :) Is there some
I need to convert a string of text containing a long url into the
I need to convert a string like this: A &#039;quote&#039; is <b>bold</b> into: A
I need to replace some letters into a List with numbers (each letter is
I need to convert a user's UTM input (WGS 1984) into Decimal Degrees, preferably
I need to convert numbers, positive and negative, into binary format - so, 2
I would like to convert a string of delimited dimension values into floating numbers.
I need a function to convert a string into only alphanumeric characters... Meaning replace
I have a list of Phone Numbers which I need to convert into a

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.