0

How can I remove function's 'none' output?

import random def random_value(x,y):     y = ord(y)+x     return chr(y) def random_value1(x,y):     y = ord(y)-x     return chr(y) def encryption(a,b):     infile = open("e:\\temp\\security.txt","r")     outfile = open("e:\\temp\\"+a+".txt","w")     security = infile.read()     for i in security:         outfile.write(random_value(b,i))     print("encryption success")     infile.close()     outfile.close() def decryption(a,b):     c = input("decryption file name : ")     infile = open("e:\\temp\\"+c+".txt","r")     outfile = open("e:\\temp\\"+a+".txt","w")     security = infile.read()     for i in security:         outfile.write(random_value1(b,i))     print("decryption success")         infile.close()     outfile.close() while True:     a=input("encryption / decryption  : ")     if not a:         break     b=input("file name : ")     c=int(input("secret key : "))     if a=="encryption":         print(encryption(b,c))     elif a=="decryption":         print(decryption(b,c))     else:         break

5th Jun 2018, 1:36 AM
park
1 Odpowiedź
+ 3
In line 36 and 38, write encryption(b, c) instead of print(encryption(b, c)) write decryption(b, c) instead of print(decryption(b, c))
5th Jun 2018, 2:26 AM
李立威