Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Easy script problem
#2
It's mainly an indentation problem. You have an outer loop that loops through the distances. You have an inner loop that loops through the characters in the plain text (you call that word, which is confusing, because it's just a character).

Your output is getting longer and longer because you never reset it. You want to reset code each time you loop to a new distance. You check to see if the character is over 127, but you only do that at the end of the loop over the phrase, so it's only checking the last character in the phrase. Likewise, you only add to the output (code) at the end of the loop over the phrase. So you are only outputting the last character for each distance.

Also, your correction for the "word" being over 127 is wrong. All you need to do is subtract 95.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
Easy script problem - by Niko047 - Jul-22-2017, 12:38 PM
RE: Easy script problem - by ichabod801 - Jul-22-2017, 01:10 PM
RE: Easy script problem - by Niko047 - Jul-22-2017, 02:58 PM
RE: Easy script problem - by ichabod801 - Jul-22-2017, 03:13 PM
RE: Easy script problem - by Niko047 - Jul-22-2017, 03:33 PM
RE: Easy script problem - by ichabod801 - Jul-22-2017, 09:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with a simple script Niko047 2 3,431 Jul-21-2017, 09:02 PM
Last Post: Niko047

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020