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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:16:35+00:00 2026-06-13T05:16:35+00:00

Learning Python here: I am simply trying to switch characters in a string. Example:

  • 0

Learning Python here: I am simply trying to switch characters in a string. Example: ‘A’ to ‘C’. The string just isn’t doing anything. Here is what I have so far:

import string
dummy = "beans"
for i in xrange(len(dummy)):
    chr(ord(dummy[i])+5)
print(dummy)
  • 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-13T05:16:37+00:00Added an answer on June 13, 2026 at 5:16 am

    Remember that strings are immutable, so you will need to re-assign your original string. You can try something along these lines:

    dummy = "beans"
    newdummy = ""
    for i in xrange(len(dummy)):
        newdummy += chr(ord(dummy[i])+5)
    dummy = newdummy
    print(dummy)
    

    This would be a more Pythonic approach:

    dummy = ''.join(chr(ord(c) + 5) for c in dummy)
    print(dummy)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just started learning python version 3 and trying to create a file
I just started using/learning Python and have some questions. I have a text file
I have only started learning Python recently. Let me explain what I am trying
I just started learning C++(coming from Java & Python) and am trying to learn
I have been here for a couple of months learning python from examples, but
I'm just learning Python & Django. (Thanks to everyone who contributes here -- it's
I'm learning python. So here's what I'm after: Inside a python script I have
I have just started learning python and i was wondering how i would get
I am just learning python. I read about Unicode characters and strings and was
I'm just learning python (with a background in VBA). Why isn't this dictionary loading?

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.