Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python script needs to be ran. I can not do it for some reason

Ok so I have written my first python script and I think It is correct it decrpyts this text however, my computer is freaking out and will not print out my decrypted text, I know for a fact this is correct because I have worked it by hand. I need two things from someone if someone would be so kind,

1) did I write the correct syntax for printing in python? 2) can someone run my python script and tell me what you get as the output?

# -*- coding: utf-8 -*-
"""

@author: Jonathan DeLorenzo
"""

import numpy as np

a={'A':0,'B':1,'C':2,'D':3,'E':4,'F':5,'G':6,'H':7,'I':8,'J':9,'K':10,'L':11,'M':12,'N':13,'O':14,'P':15,'Q':16,'R':17,'S':18,'T':19,'U':20,'V':21,'W':22,'X':23,'Y':24,'Z':25}
b=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
c='VZLUCCDIFXKHABEQUYIMILQKPLDVANDZEDPMOIEAVXWBKHUSMGOHLTCBSLSXFRWSLSORRHKHDZUHILQKNXBVVYOUMUPBXDORKHFUYJVZTOBZORBZZUORTIHLQVBZKHANBLCTQVLUOIGQULQVMHORVJVZHRBZDIMVABFTLUIMXDDJCBFNBZPOOIDDBYCTSVQVIRGFFHHLBHIFBZISMQVXWBULGSVXIAANKHGBPPESDILUQVGSIOVZDTFAIWHFSXLUGRCTALGSXDORBLIDANKHGBANRKSGKQYJAXVZKPQVCPWMCZCQEDUDEMGSQGNXKSFRNLFCWYQGQQUHAYZGACPGLUZHCGPGBZDQUYOSZLLUWMCZSGKODVXDDJZLLUQWANXNGSMTRVZHMLRGQKVBLUABAKQTORIQDILUQVNXWSIWWMFRQGDOCBIOVEDNESZVRDGBGRGSANOVXDVSFTLUTKAGYOMTDBANDZNHJZLHMTDBNXWSIWCPWMCESEPBALGSIMMTVZNXKTDDFKMTANPSGSBPDI'

d=[(11,4),(7,3)]

h =''

for i in range(0,267):
    e=c[2*i:2*i+2]
    f=e[0]
    g=e[1]
    x1=a[f]
    x2=a[g]
    y1=np.mod(11*x1+4*x2,26)
    y2=np.mod(7*x1+3*x2,26)
    h=h+b[y1]+b[y2]
    print , h
like image 526
Hex Delper Avatar asked Apr 29 '26 01:04

Hex Delper


1 Answers

Your print call is not correct. It should be either:

print h

for Python 2.x, or:

print(h)

for Python 3.x

like image 190
nestedloop Avatar answered Apr 30 '26 15:04

nestedloop