# # ps5pr2.py (Problem Set 5, Problem 2) # # List Comprehension # ## INSTRUCTIONS: Uncomment these lines as you go, and test them at the console # #lc1 = [ for x in range(5)] # # # # #words = ['hello', 'world', 'how', 'goes', 'it?'] #lc2 = [ for w in words] # # # #lc3 = [ for word in ['hello', 'bye', 'no']] # # # # #lc4 = [ for x in range(1, 10) if ] # # # # #lc5 = [ for c in 'bu be you'] # # # ## continue with writing functions below: if __name__ == '__main__': # test code below, do not modify! for x in ['lc1', 'lc2', 'lc3', 'lc4', 'lc5']: if x in dir(): print(x + ' = ', eval(x))