Skip to content

Commit

Permalink
Merge pull request #10 from silshack/gh-pages
Browse files Browse the repository at this point in the history
Update Repository
  • Loading branch information
leslieho committed Sep 30, 2013
2 parents 409422d + 2638027 commit b02f344
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
9 changes: 9 additions & 0 deletions _posts/2013-09-30-python-program.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
layout: post
author: mbaxter
category: post
---
Here is the screenshot of my terminal window after finishing Exercise Two:
![Ubuntu Screenshot](https://lh4.googleusercontent.com/-tEca61KR_-Y/UkmAn-UgcqI/AAAAAAAAAV0/CcMleZaBLfw/w607-h322-no/Screen+Shot+2013-09-30+at+9.21.54+AM.png "Ubuntu Screenshot")

A little shoutout to Grant for helping me, with great patience, on that exercise!
41 changes: 41 additions & 0 deletions _posts/jpulliza/2013-09-30-Jonathan-Python-Names-Code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: post
author: jpulliza
categories: post
title: Jonathan's Python Names Code
---

```python
def add_names(list_of_names, file):
"""
Opens and adds a list of names to the end of a file, each on its own line
"""
# We open a file in 'a' mode, for appending to it.
names_file = open(file, 'a')

# For each line in the list, we print that to the file.
# This assumes one file per line.
for name in list_of_names:
print >> names_file, name

# Close the file so the changes are visible.
print file + ' written successfully'
names_file.close()


# Exercise: make new_names customizible:
new_names = input('Enter a list of names:')

# Exercise: make the file name used here customizible:

file = input('Enter a file name:')

add_names(new_names, file)







```

0 comments on commit b02f344

Please sign in to comment.