python help

Posts 115 of 17 · Page 1 of 2
y dont u use the built in encryption libraries and methods
Code:
def encode(key, string):
    encoded_chars = []
    for i in xrange(string):
        key_c = key[i % len(key)]
        encoded_c = chr(ord(string[i]) + ord(encoded_c) % 256)
        encoded_chars.append(encoded_c)
    encoded_string = "".join(encoded_chars)
    return base64.urlsafe_b64encode(encoded_string)
source from stackoverflow
Quote Originally Posted by ******* View Post
y dont u use the built in encryption libraries and methods
Code:
def encode(key, string):
    encoded_chars = []
    for i in xrange(string):
        key_c = key[i % len(key)]
        encoded_c = chr(ord(string[i]) + ord(encoded_c) % 256)
        encoded_chars.append(encoded_c)
    encoded_string = "".join(encoded_chars)
    return base64.urlsafe_b64encode(encoded_string)
source from stackoverflow
because technically this is for my gcse so if i used that i would be disqualified for cheating
Try this place.

And can't Google help?
Quote Originally Posted by Batman View Post
Try this place.

And can't Google help?
i see no python section and no i have searched all over
python is the worst thing to happen to coding

use java
Quote Originally Posted by Jew View Post
python is the worst thing to happen to coding

use java
i would if i could but im required to use python its part off the specifacation or i would use visual basic for the gui its easier -.-
Quote Originally Posted by Jew View Post
python is the worst thing to happen to coding

use java
Are you an autism enthusiast?
Python is one of the most powerful upcoming languages in the recent decades. It's replaced Fortran with the amount of scientific and mathematical libraries users have developed, is beginning to become Perl's number one competitor, it's a scripting language thus it's much simpler as well as the syntax makes it flexible and easy to learn, and furthermore although it's considered a scripting language is used for third tier architectural programs all the time. The immediacy of it being "scripty" along with it's easy to learn syntax/simplicity makes it a language you can always rely on.

Nonetheless, Java is a great language, but I think the statement of it being the worst thing to happen to coding is absurd and I'm honestly offended that someone would be so oblivious.

(looking at code, will edit)

edit:
Uh, if the issue you're encountering is that it prints out twice that's because you've assigned the variable recall to 'yes' and then right after you have a while statement for while it's yes, print translated. Thus, it will print the translated message twice because right above you have: print translated.

http://i.imgur.com/jfMRBvP.png
Quote Originally Posted by thisisreal34 View Post
i would if i could but im required to use python its part off the specifacation or i would use visual basic for the gui its easier -.-
look.

i dont code python but from what i can you are not debugging your code.

make sure to print out things for every line of code to assist you at finding the problem
freaken python :|
edit: dude.. you're just printing translated again in the while loop..
Quote Originally Posted by Youtro View Post
freaken python :|
edit: dude.. you're just printing translated again in the while loop..
if i dont put it there when you type yes it wont recall the message
Quote Originally Posted by thisisreal34 View Post
if i dont put it there when you type yes it wont recall the message
print ("do you want to recall?")
recall = input()
then you start the while loop.
Quote Originally Posted by Youtro View Post

print ("do you want to recall?")
recall = input()
then you start the while loop.
now it just spams the translated on and on solution for that ?

- - - Updated - - -

Quote Originally Posted by Youtro View Post

print ("do you want to recall?")
recall = input()
then you start the while loop.
added a break thanks alot
Quote Originally Posted by thisisreal34 View Post
now it just spams the translated on and on solution for that ?
sigh.. just remove the first "print(translated)" just above the comment in the middle.. this code is so shit lol

(in your original code i.e)
this is ur second thread isnt it...
Posts 115 of 17 · Page 1 of 2

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?