Skip to content

Commit ea2ddaa

Browse files
committed
all valid python 3
1 parent b566055 commit ea2ddaa

37 files changed

+76
-1436
lines changed

boolean_algebra/quine_mc_cluskey.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def prime_implicant_chart(prime_implicants, binary):
9999
return chart
100100

101101
def main():
102-
no_of_variable = int(raw_input("Enter the no. of variables\n"))
103-
minterms = [int(x) for x in raw_input("Enter the decimal representation of Minterms 'Spaces Seprated'\n").split()]
102+
no_of_variable = int(input("Enter the no. of variables\n"))
103+
minterms = [int(x) for x in input("Enter the decimal representation of Minterms 'Spaces Seprated'\n").split()]
104104
binary = decimal_to_binary(no_of_variable, minterms)
105105

106106
prime_implicants = check(binary)
@@ -113,4 +113,4 @@ def main():
113113
print(essential_prime_implicants)
114114

115115
if __name__ == '__main__':
116-
main()
116+
main()

ciphers/affine_cipher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
SYMBOLS = """ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"""
55

66
def main():
7-
message = raw_input('Enter message: ')
8-
key = int(raw_input('Enter key [2000 - 9000]: '))
9-
mode = raw_input('Encrypt/Decrypt [E/D]: ')
7+
message = input('Enter message: ')
8+
key = int(input('Enter key [2000 - 9000]: '))
9+
mode = input('Encrypt/Decrypt [E/D]: ')
1010

1111
if mode.lower().startswith('e'):
1212
mode = 'encrypt'

ciphers/brute_force_caesar_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def decrypt(message):
4444
print("Decryption using Key #%s: %s" % (key, translated))
4545

4646
def main():
47-
message = raw_input("Encrypted message: ")
47+
message = input("Encrypted message: ")
4848
message = message.upper()
4949
decrypt(message)
5050

ciphers/caesar_cipher.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@ def main():
4040
print("3.BruteForce")
4141
print("4.Quit")
4242
while True:
43-
choice = raw_input("What would you like to do?: ")
43+
choice = input("What would you like to do?: ")
4444
if choice not in ['1', '2', '3', '4']:
4545
print ("Invalid choice")
4646
elif choice == '1':
47-
strng = raw_input("Please enter the string to be ecrypted: ")
47+
strng = input("Please enter the string to be ecrypted: ")
4848
while True:
4949
key = int(input("Please enter off-set between 1-94: "))
5050
if key in range(1, 95):
5151
print (encrypt(strng, key))
5252
main()
5353
elif choice == '2':
54-
strng = raw_input("Please enter the string to be decrypted: ")
54+
strng = input("Please enter the string to be decrypted: ")
5555
while True:
5656
key = raw_int(input("Please enter off-set between 1-94: "))
5757
if key > 0 and key <= 94:
5858
print(decrypt(strng, key))
5959
main()
6060
elif choice == '3':
61-
strng = raw_input("Please enter the string to be decrypted: ")
61+
strng = input("Please enter the string to be decrypted: ")
6262
brute_force(strng)
6363
main()
6464
elif choice == '4':

ciphers/rsa_cipher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
def main():
88
filename = 'encrypted_file.txt'
9-
response = raw_input('Encrypte\Decrypt [e\d]: ')
9+
response = input('Encrypte\Decrypt [e\d]: ')
1010

1111
if response.lower().startswith('e'):
1212
mode = 'encrypt'

ciphers/simple_substitution_cipher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
55

66
def main():
7-
message = raw_input('Enter message: ')
7+
message = input('Enter message: ')
88
key = 'LFWOAYUISVKMNXPBDCRJTQEGHZ'
9-
resp = raw_input('Encrypt/Decrypt [e/d]: ')
9+
resp = input('Encrypt/Decrypt [e/d]: ')
1010

1111
checkValidKey(key)
1212

ciphers/transposition_cipher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import math
33

44
def main():
5-
message = raw_input('Enter message: ')
6-
key = int(raw_input('Enter key [2-%s]: ' % (len(message) - 1)))
7-
mode = raw_input('Encryption/Decryption [e/d]: ')
5+
message = input('Enter message: ')
6+
key = int(input('Enter key [2-%s]: ' % (len(message) - 1)))
7+
mode = input('Encryption/Decryption [e/d]: ')
88

99
if mode.lower().startswith('e'):
1010
text = encryptMessage(key, message)

ciphers/transposition_cipher_encrypt_decrypt_file.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
def main():
66
inputFile = 'Prehistoric Men.txt'
77
outputFile = 'Output.txt'
8-
key = int(raw_input('Enter key: '))
9-
mode = raw_input('Encrypt/Decrypt [e/d]: ')
8+
key = int(input('Enter key: '))
9+
mode = input('Encrypt/Decrypt [e/d]: ')
1010

1111
if not os.path.exists(inputFile):
1212
print('File %s does not exist. Quitting...' % inputFile)
1313
sys.exit()
1414
if os.path.exists(outputFile):
1515
print('Overwrite %s? [y/n]' % outputFile)
16-
response = raw_input('> ')
16+
response = input('> ')
1717
if not response.lower().startswith('y'):
1818
sys.exit()
1919

ciphers/vigenere_cipher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
33

44
def main():
5-
message = raw_input('Enter message: ')
6-
key = raw_input('Enter key [alphanumeric]: ')
7-
mode = raw_input('Encrypt/Decrypt [e/d]: ')
5+
message = input('Enter message: ')
6+
key = input('Enter key [alphanumeric]: ')
7+
mode = input('Encrypt/Decrypt [e/d]: ')
88

99
if mode.lower().startswith('e'):
1010
mode = 'encrypt'

data_structures/graph/bellman_ford.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ def BellmanFord(graph, V, E, src):
3535

3636

3737
#MAIN
38-
V = int(raw_input("Enter number of vertices: "))
39-
E = int(raw_input("Enter number of edges: "))
38+
V = int(input("Enter number of vertices: "))
39+
E = int(input("Enter number of edges: "))
4040

4141
graph = [dict() for j in range(E)]
4242

@@ -45,10 +45,10 @@ def BellmanFord(graph, V, E, src):
4545

4646
for i in range(E):
4747
print("\nEdge ",i+1)
48-
src = int(raw_input("Enter source:"))
49-
dst = int(raw_input("Enter destination:"))
50-
weight = float(raw_input("Enter weight:"))
48+
src = int(input("Enter source:"))
49+
dst = int(input("Enter destination:"))
50+
weight = float(input("Enter weight:"))
5151
graph[i] = {"src": src,"dst": dst, "weight": weight}
5252

53-
gsrc = int(raw_input("\nEnter shortest path source:"))
53+
gsrc = int(input("\nEnter shortest path source:"))
5454
BellmanFord(graph, V, E, gsrc)

0 commit comments

Comments
 (0)