Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Saturday, October 16, 2010

Spamming

#!/usr/bin/python
import smtplib

sender = 'admin@zzz.ac.in'
receivers = ['xxx@gmail.com']
# sender = in mail transcript it will show this sender address
# receivers = actual address where we want to send the mail

message = """From: name 
To: name 
Subject: Test Mail, plz ignore

how are you ?

"""

smtpObj = smtplib.SMTP('students.iiit.ac.in')
# do change smtpObj according to your position
print "Successfully sent email"
smtpObj.sendmail(sender, receivers, message)



When this python code is run, it will send the mail to the addresses mentioned in receivers which is a list in python. prototype is similar to gmail. It does show the ip address in the complete info of the mail. But there's a way to hide ip in proxy servers. Try it.

Sunday, August 15, 2010

KAMIL

This is a challenge task in spoj. Link to the problem KAMIL
The best i could manage is 71 in python. Here's the source code:


for i in range(10):
b=1
for i in raw_input():
if i in'LFTD':b*=2
print b


If anyone has better solution please share :)

PS : Here i am attaching the code with score of 77 because i think that its size can be reduced. If you want the 71 char. code then reply back.

SIZECON

This is a challenge task in spoj. Link to the problem SIZECON
The best i could manage is 48 in python. Here's the source code:


q=0
w=input()
while w:
w-=1
a=input()
if a>0:q+=a
print q

if anyone has done better please share your approach :)