-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJumbled(withouttkinter).py
More file actions
59 lines (53 loc) · 1.42 KB
/
Jumbled(withouttkinter).py
File metadata and controls
59 lines (53 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import sys
from collections import defaultdict
print " ";
print "................................Jumbled ......................................";
print "NOTE : Please make sure, you enter all the letters necessary to make the word!";
print " ";
print " ";
word=raw_input("Enter the word: ")
print " ";
#word = sys.argv[1]
word1 = word
#print word1
leng=len(word)
no = leng
chek=''
dict = defaultdict(list)
#word=raw_input("Enter the : ")
word = word.lower()
word = sorted(word)
word = ''.join(word)
word = "\n"+word
word = word.replace(" ", "")
file = open("C:\Python27\Jumbled\Dictionary.txt", "r")
line = file.readline()
print " "
count = 0;
while line:
if(line!=None):
line = file.readline()
j = line
line = sorted(line)
line = ''.join(line)
j = ''.join(j)
k = sorted(j)
k = ''.join(k)
k = k.lower()
if (word==k):
if(count<1):
print "Solution : "+j+"\n",
count=count+1;
if(count>1):
print "Another Combnation : "+j
if(j=="mazahir"):
print "'Mazahir' here! :), Hope you liked my program :D"
#dict[word].append(k)
file.close()
fo = open("C:/Mazahir/now.txt", "w")
line = fo.write( j )
fo.close()
file = open("C:/Mazahir/now1.txt", "w")
file.write( str(no) )
file.close()