CSCI 110, Spring 2011
Home | | Course Schedule | | Assignments | | Lecture NotesLab 1 solution
# Program: hello.py
# Author: Brenda Student
# Class: CSCI 110 Section 01
# Date: 2/1/11
# Assignment: Lab1 Problem 1
# Purpose: Get the user's name and city and print a greeting
name = raw_input("What is your name? ") # name is user's name
city = raw_input("What city are you from? " ) # city is user's hometown
print "Hello " + name + "!"
print "I hear " + city + " is a wonderful place!"
# Program: converter.py
# Author: Brenda Student
# Class: CSCI 110 Section 01
# Date: 2/1/11
# Assignment: Lab1 Problem 2
# Purpose: Convert length from feet to inches
length = input("Enter a length in feet: ")
inches = length * 12
print length, "feet is the same as", inches, "inches."
# Program: word.py
# Author: Brenda Student
# Class: CSCI 110 Section 01
# Date: 2/1/11
# Assignment: Lab 1 Problem 3
# Purpose: Ask for a word and print out information about it
word = raw_input("Please enter a word: ")
print "You entered: " + word
print "The length is: ", len(word)
print "The first letter is: ", word[0]
print "The last letter is: ", word[len(word) - 1]