This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=600851475143 | |
i=2 | |
while i<a : | |
if a%i==0: | |
a1=a/i | |
else : | |
i+=1 | |
continue | |
n=2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=2**1000 | |
b=0 | |
while a: | |
b=b+a%10 | |
a/=10 | |
print b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=100 | |
b=0 | |
f1=1 | |
while a>1: | |
f1=a*f1 | |
a-=1 | |
f=f1 | |
while f: | |
b=b+f%10 | |
f/=10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from string import split | |
f=open(sys.argv[1]) | |
content=f.read() | |
print content | |
print 'the no.of lines in file = '+ str(len(split(content,'\n'))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from string import split | |
f=open(sys.argv[1]) | |
content=f.read() | |
print content | |
print 'the no.of sentences in file = '+ str(len(split(content,'.'))-1) | |
# we sub 1 is because split creates a null element after the last '.' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from string import split | |
f=open(sys.argv[1]) | |
content=f.read() | |
#print content | |
sentence=split(content,'.') | |
largest=smallest=len(sentence[0]) | |
total=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import shlex | |
f=open(sys.argv[1]) | |
content=f.read() | |
words=shlex.split(content) | |
print 'word count = '+ str(len(words)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import shlex | |
import string | |
f=open(sys.argv[1]) | |
content=f.read() | |
sen=string.split(content,'.') | |
print sen | |
words=[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string,sys | |
f=open(sys.argv[1]) | |
content= string.lower(f.read()) | |
workinglist =string.split(content) | |
cleanlist =[] | |
for item in workinglist: | |
temp=item.strip(string.punctuation) | |
cleanlist=cleanlist+[temp,] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string,sys | |
f1=open(sys.argv[1]) | |
f2=open(sys.argv[2]) | |
content= string.lower(f1.read()) | |
noisecontent= string.lower(f2.read()) | |
workinglist =string.split(content) | |
cleanlist =[] | |
for item in workinglist: |
OlderNewer