CSC111 Print Exercises

From dftwiki3
Revision as of 09:35, 3 February 2010 by Thiebaut (talk | contribs) (Created page with '<source lang="python"> # D. Thiebaut # Predict the output of the program below def main(): a = 3 degrees = 29 pi = 3.14159 name = "Julie" town = "Northampt…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
# D. Thiebaut
# Predict the output of the program below 

def main():
    a = 3
    degrees = 29
    pi = 3.14159
    name = "Julie"
    town = "Northampton"
    
    print a, pi, name, town

    raw_input( ">" )

    print "the temperature in", town, "is", degrees, "degrees"
    
    raw_input( ">" )

    print "I love living in", town, "!"

    raw_input( ">" )

    print "The temperature in ", town, "is", degrees, "!"

    raw_input( ">" )
    
    print "the temperature in, say,", town, "isn't", degrees

    raw_input( ">" )

    print '"',",","',',","''",'",',",,'"

    raw_input( ">" )

    print '"'+"+"+"'+',"+"+'"+'"-,'+"+,'"

    raw_input( ">" )

    print '"'+"+"+"'+',"+"+'"+'"-,'+"+,'"*3

    x = raw_input( "Enter a number between 0 and 10: " )
    y = raw_input( "Enter another number between 0 and 10: " )
    print "x + y =", x+y

    raw_input( ">" )

    x = raw_input( ": " )
    y = input( ": " )
    print "x*y =",  x * y
    
main()