Difference between revisions of "CSC111 Python Programs Fall 2015"

From dftwiki3
Jump to: navigation, search
(Created page with "--~~~~ ---- =Wed. Sept. 16, 2015= <br /> <source lang="python"> # displayWeek.py # D. Thiebaut # displays a schedule for the five days of the week length = eval( input( "Leng...")
 
(Wed. Sept. 16, 2015)
Line 22: Line 22:
  
 
<br />
 
<br />
 +
<source lang="python">
 +
# displayGrade.py
 +
# D. Thiebaut
 +
#
 +
# prompts user for information and
 +
# grade.
 +
# display user's grade in graph, along with
 +
# class average (constant)
 +
 +
 +
# constant information
 +
classAvg = 80
 +
 +
# user input.  Get info from user
 +
fName = "Dominique"
 +
lName = "Thiebaut"
 +
Id    = 990123456
 +
final = 90
 +
 +
# format information and display
 +
bar = "+" + 48*"-" + "+"
 +
print( bar )
 +
print( "|", fName, lName, Id, "|" )
 +
print( bar )
 +
print( final )
 +
print( classAvg )
 +
 +
 +
</source>
 
<br />
 
<br />
 
<br />
 
<br />

Revision as of 11:52, 18 September 2015

--D. Thiebaut (talk) 10:34, 18 September 2015 (EDT)


Wed. Sept. 16, 2015


# displayWeek.py
# D. Thiebaut
# displays a schedule for the five days of the week

length = eval( input( "Length of bar? " ) )

print( "-" * length )
for day in [ "Mo:", "Tu:", "We:", "Th:", "Fr:" ]:
    print( day )
    #print( "  :" * 2)
    print( "  :" )
    print( "-" * length )


# displayGrade.py
# D. Thiebaut
#
# prompts user for information and
# grade.
# display user's grade in graph, along with
# class average (constant)


# constant information
classAvg = 80

# user input.  Get info from user
fName = "Dominique"
lName = "Thiebaut"
Id    = 990123456
final = 90

# format information and display
bar = "+" + 48*"-" + "+"
print( bar )
print( "|", fName, lName, Id, "|" )
print( bar )
print( final )
print( classAvg )