# Homework 1: Sorting and Python refresher

• Due before class on Friday, August 26
• Submit using the submit program as 301 hw 01.

# Assignment

This homework has three parts.

Part One: Write a program called sorter.py which takes in three integers from the user, and then prints them out in sorted order, as demonstrated below:

roche@soy:~/sy301/hws/HW1\$ python3 sorter.py
Int 1? 2
Int 2? 1
Int 3? 3
1 2 3


I want you to write this one "from scratch" - without using Python's built-in sort function.

Part Two: In a file called hw1.py, write a function called three_sort which accepts three integers, and returns (not prints) a list with the three integers in sorted order.

Part Three: Also in hw1.py, write a function called every_other which accepts a list of items, and returns a list containing only the first, third, fifth, etc. items. In other words, if the incoming list is: ['a', 'b', 'c', 'd', 'e'], the returned list should be: ['a','c','e'].

# Submission

Place sorter.py and hw1.py in a directory and submit as hw 01. The submission script instructions are here.

If you can't figure out submission for this one, that's OK, we'll go over it at during class on Wednesday.

# Code Environment

I don't care where you do your coding. In SY201, you used an IDE, which is fine. However, I think it would probably behoove you to have some experience outside an IDE, as well. For this, you would create/edit your code in a text editor, such as gedit, vim, or emacs (the latter two have a steeper learning curve, but once you know what you're doing, you'll be a much, much faster programmer).

The only caveat to "I don't care how you do your coding," is that I'll run your code from the command line, on one of our lab Linux machines; you should make sure it works there before submitting.