Last active
August 29, 2015 14:16
-
-
Save zmariscal/ef0045ddc37f6d34b720 to your computer and use it in GitHub Desktop.
make a list of 5 things you're grateful for
This file contains 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
from sys import argv | |
from os.path import exists | |
script, filename = argv | |
print "What are five things you're grateful for today?" | |
print "First:" | |
First = raw_input("> ") | |
print "Second:" | |
Second = raw_input("> ") | |
print "Third:" | |
Third = raw_input("> ") | |
print "Fourth:" | |
Fourth = raw_input("> ") | |
print "Fifth:" | |
Fifth = raw_input("> ") | |
print "These are things things you're grateful for on:" | |
print "1.%s\n2.%s\n3.%s\n4.%s\n5.%s\n" % (First, Second, Third, Fourth, Fifth) | |
f = open('grateful.txt', 'a') | |
f.write("1. %s\n2. %s\n3. %s\n4. %s\n5. %s\n" % (First, Second, Third, Fourth, Fifth)) | |
f.write("\n==============================================\n") | |
f.close() |
line 26, check out the usage of 'with'. see the example at the bottom. http://effbot.org/zone/python-with-statement.htm
Also, consider using loops to make your code clearer.
I don't think line 2 from os.path import exists
is necessary.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
filename is not used