# Model Solution to Homework 1, CS151, Fall 2010 at ISU
# Written by Jeff Kinne

# I am showing you in this file how to format your homeworks
# from now on.  
#
# You will type your Python functions in a file
# called with your first name, last name, the hw number, then
# .py at the end, so for me it is JeffKinneHW1.py
#
# For questions that ask for functions, just put the functions
# in your code, with a comment above the function saying the 
# problem number.
#
# For questions asking for you to answer some question, like
# "describe what happens when you run the function", then put the
# answer in a comment.
#
# So I will show you how to do this for the homework 1 problems.
# Here goes...


# Problem 1
# The problem did not ask for a function, so I will type the 
# Python commands in a comment.
# >>> x1 = 2
# >>> x2 = 3
# >>> x3 = 5
# >>> x4 = 7
# >>> average = (x1 + x2 + x3 + x4)/4
# >>> print "The average is", average


# Problem 2
# The Python commands for the command area would be the following.
# >>> pic = makePicture(pickAFile())
# >>> show(pic)


# Problem 3
# The Python commands for the command area would be the following.
# >>> n = 25
# >>> print "The remainder dividing by 5 is", n%5
# >>> print "The remainder dividing by 3 is", n%3
# >>> print "The remainder dividing by 2 is", n%2


# Problem 4
#
# Many of you described what we know about how computers store
# numbers, text, and pictures.  Everything on the computer is just
# 1's and 0's, but the computer can interpret them in different
# ways.  Numbers of just 1's ans 0's interpreted as binary numbers.
# We get text by associating each character/letter with a number.
# We get pictures by breaking the picture into different pixels
# and listing for each the red, green, and blue values (numbers
# between 0 and 255).
#
# This question asked you to describe how the computer might 
# store a webpage.  Most of you did not really answer this.  Here is
# my answer.  A webpage is really just a text file.  The text file
# needs to instruct the web browser how to display the text in the 
# file.  For example, how large should the text be on the screen, 
# should there be a hyperlink to another web page, should a picture
# be on the screen, etc.  HTML is a markup language that allows us to 
# do this.  You can think of it like writing out some text on paper
# and then taking a red pen and making marks/notes about how to 
# display text.  So the text file for the webpage should have some 
# way for doing this, a way the web browser knows when you are giving 
# it "instructions" for how to display the text and when you are giving
# it the actual text to display.  In HTML this is accomplished by 
# using "tags" like <b>Hello World</b> to say that the text inside
# of <b></b> should be bold.  There would be similar tags to say what
# size the text should be, what color, etc.


# What about putting functions in the homework file?
#
# For all the rest of the homeworks, you will have functions in your
# file, so I will show how to do that here too.
# 
# Suppose there was a problem 5 that asked "Write a function to
# multiply three numbers that are inputs to that function,
# print the result to the screen, and return the product as output".  
# Then my solution to that problem would look like this.


# Problem 5
# 
# Function that multiplies the numbers and prints the result
# to the screen.
def multNumbers(a, b, c):
  product = a*b*c
  print "The product of the numbers", a, "and", b, "and", c, "is", product
  return product