Facebook
From Emerald Meerkat, 4 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 146
  1. # Ralia Vandyoussefi
  2. # COMP_D-X
  3. # R00185407
  4.  
  5. import reading_from_user as rfu
  6. names = []
  7. codes = []
  8.  
  9.  
  10. def modules_list():
  11.     with open('modules.txt') as module:
  12.         for line in module:
  13.             split = line.split(",")
  14.             codes.append(split[0])
  15.             split_space = line.split(", ")
  16.             names.append(split_space[1])
  17.     return codes, names
  18.  
  19.  
  20. def main():
  21.     modules_list()
  22.     while True:
  23.         menu = rfu.read_integer('Module Record System - Options\n'
  24.                                 '-------------------------------\n'
  25.                                 '1. Record Attendance \n'
  26.                                 '2. Generate Statistics \n'
  27.                                 '3. Exit \n'
  28.                                 '>>>>')
  29.         if menu == 1:
  30.             print('Which module?')
  31.             for i in codes:
  32.                 print(codes.index(i) + 1, end='.')
  33.                 print(i)
  34.             user_choose = rfu.read_integer('Please choose a number:')
  35.             if user_choose == 1:
  36.                 print(names[0])
  37.             elif user_choose == 2:
  38.                 print(names[1])
  39.             else:
  40.                 print('Try Again')
  41.         elif menu == 2:
  42.             print('Which module?')
  43.             for i in codes:
  44.                 print(codes.index(i) + 1, end='.')
  45.                 print(i)
  46.             user_choose = rfu.read_integer('Please choose a number:')
  47.             if user_choose == 1:
  48.                 print(names[0])
  49.             elif user_choose == 2:
  50.                 print(names[1])
  51.             else:
  52.                 print('Try Again')
  53.         elif menu == 3:
  54.             print('Goodbye')
  55.             break
  56.         else:
  57.             print('Number has to be (1-3)')
  58.  
  59.  
  60. main()
  61.