# Selected solutions for Lab 4
import os
def main1():
Id = raw_input( "Please enter Id of student (e.g. aa) " )
command = "111c-" + Id
os.system( "lastlog -u " + command )
def main2():
for Id in "abcdefghijklmnopqrstuvwxyz":
user = "111c-a" + Id
os.system( "lastlog -u " + user )
def main3():
for semester in [ 'a', 'b' ]:
for Id in "abcdefghijklmnopqrstuvwxyz":
user = "111c-" + semester + Id
os.system( "lastlog -u " + user )
def main4():
for second in "abcdefghijklmnopqrstuvwxyz":
for first in "abc":
print first+second, # comma to stay on the same line
print # once we've printed 3, go to next line
def main5():
filename = raw_input( "Filename? " )
filenameNoExtension = filename[0:-3]
print filenameNoExtension + "txt"
main1()
main2()
main3()
main4()
main5()