Difference between revisions of "CSC111 Homework 4 Solution"
(Created page with '--~~~~ ---- ==Program 1== <source lang="python"> . #hw4a.py #111c-ap #Alecia M. D'Entremont #(Edited by D. Thiebaut) #Last edited 2.25.10 #This program calculates the final #g…') |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
--[[User:Thiebaut|D. Thiebaut]] 16:17, 3 March 2010 (UTC) | --[[User:Thiebaut|D. Thiebaut]] 16:17, 3 March 2010 (UTC) | ||
---- | ---- | ||
− | + | <onlydft> | |
==Program 1== | ==Program 1== | ||
Line 79: | Line 79: | ||
. | . | ||
</source> | </source> | ||
+ | |||
+ | ==Program 2== | ||
+ | |||
+ | <source lang="python"> | ||
+ | . | ||
+ | #hw4b.py | ||
+ | #111c-ap | ||
+ | #Alecia M. D'Entremont | ||
+ | #Last Edited 2.25.10 | ||
+ | |||
+ | #This program will let the user know the last time | ||
+ | #any CS department professors logged in | ||
+ | |||
+ | import os | ||
+ | |||
+ | def main(): | ||
+ | ## list of classes, two semesters | ||
+ | classes = ["111", "112", "220", "231", "240", | ||
+ | "249", "250", "270", "260", "352"] | ||
+ | semester = 'ab' | ||
+ | |||
+ | ## print login info for all profs, first fall semester then spring semester | ||
+ | for letter in semester: | ||
+ | for course in classes: | ||
+ | os.system("lastlog -u " + course + letter) | ||
+ | |||
+ | main() | ||
+ | . | ||
+ | </source> | ||
+ | </onlydft> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | <br /> | ||
+ | [[Category:CSC111]][[Category:Python]][[Category:Homework]] |