How to save python codes in files?

why? jimbomaan at gmail.com
Thu Jun 14 00:56:13 EDT 2007


I tried but its not working. Here's a code for sum of two numbers. Now
how do i save it?

>>>  #! /usr/bin/env python
...
>>> def sum(x,y):
...     return x+y
...
>>> x=int(raw_input('Enter a number: '))
Enter a number: 35
>>> y=int(raw_input('Enter a number: '))
Enter a number: 7
>>> print 'sum is', sum(x,y)
sum is 42




More information about the Python-list mailing list