CSCI 110, Spring 2011

    Home | | Course Schedule | | Assignments | | Lecture Notes

    Homework 1 solution

    Solution to Problem 1:

    #Program: journey.py
    #Author: Brenda Student
    #Class: CSCI 110, Section 01
    #Date: 2/7/11
    #Assignment: Homework 1
    #Purpose: Asks a few questions and repeats the answers in a sentence format}
    
    name = raw_input("Hi there! What is your name? ")
    destination = raw_input("Where are you going? ")
    miles = input("How far have you traveled (in miles)? ")
    print ""
    print "Let me see if I have this straight:"
    print name + " has traveled", miles*5280, "feet on the way to " + destination + "."
    print ""
    print "Thanks for running the program."
    
    

    Solution to problem 2:

    #Program: tipComputer.py
    #Author: Brenda Student
    #Class: CSCI 110, Section 01
    #Date: 2/7/11
    #Assignment: Homework 1
    #Purpose: Asks a few questions and repeats the answers in a sentence format}
    
    bill = input("Please enter the amount of the bill: ")
    print ""
    print "A 15% tip would be $", .15*bill
    print "A 20% tip would be $", .20*bill