Advertisement
Leeeo

CinemaSeater2000.0 - 28/08/2015 10:16am (Stable(?))

Aug 27th, 2015
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 23.43 KB | None | 0 0
  1. #-------------------------------------------------------------------------------
  2. # Name:        Cinema Seater 2000.0
  3. # Purpose:     Software Assignment
  4. #
  5. # Author:      Leo Carnovale
  6. #
  7. # Created:     04/08/2015
  8. # Copyright:   (c) L.Carnovale 2015
  9. # Licence:     Learner's Permit
  10. #-------------------------------------------------------------------------------
  11. KEY = 4
  12. import hashlib
  13. from math import log
  14. def BaseConvert(number, StartBase, EndBase):
  15.     try:
  16.         n = int(str(StartBase)) + int(str(EndBase))
  17.     except ValueError:
  18.         return "Bad Base input"
  19.     StartBase, EndBase = int(StartBase), int(EndBase)
  20.     letters = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P']
  21.     StartLength = len(str(number))
  22.     for i in str(number):
  23.         if i not in letters:
  24.             try:
  25.                 a = int(i)
  26.             except ValueError:
  27.                 return "Bad input"
  28.     total = 0
  29.     for i in range(StartLength):
  30.         n = StartLength - i - 1
  31.         X = str(number)[n]
  32.         if X in letters:
  33.             X = letters.index(X) + 10
  34.         X = int(X)
  35.         if X > StartBase:
  36.             return "Bad start base"
  37.         total += int(X) * (StartBase ** i)
  38.     number = total
  39.     if EndBase > 1:
  40.         n2 = int(log(number, EndBase))
  41.     elif EndBase == 1:
  42.         n2 = number
  43.     else:
  44.         print("Unable to complete base conversion")
  45.         return
  46.     total = number
  47.     numbers = []
  48.     for i in range(n2 + 1):
  49.         X = int(total/(EndBase ** (n2 - i)))
  50.         if X > 9:
  51.             X = str(X)
  52.         numbers.append(str(X))
  53.         total = total % EndBase ** (n2 - i)
  54.     EndNumber = '|'.join(numbers)
  55.     Time = EndNumber.split("|")
  56.     if int(Time[0]) < 12:
  57.         part = "am"
  58.         NewTime1 = int(Time[0])
  59.     else:
  60.         part = "pm"
  61.         NewTime1 = int(Time[0]) - 12
  62.         if NewTime1 == 0:
  63.             NewTime1 = 12
  64.     if len(Time[1]) == 1:
  65.         NewTime2 = "0" + Time[1]
  66.     else:
  67.         NewTime2 = Time[1]
  68.     Time = str(NewTime1) + ":" + str(NewTime2) + part
  69.  
  70.     return Time
  71. def StripNumber(Number):
  72.     if type(Number) != float:
  73.         try:
  74.             Number = float(Number)
  75.         except ValueError:
  76.             return Number
  77.     Number = str(Number)
  78.     Decimals = Number.split(".")[1]
  79.     Decimals = ''.join(reversed([x for x in str(int(''.join(reversed([x for x in Decimals]))))]))
  80.     Number = int(Number.split(".")[0])
  81.     return str(Number) + "." + str(Decimals)
  82.  
  83.  
  84.  
  85. def PrintTimeTable(cinema):
  86.     global BaseConvert
  87.     tab = max([len(x) for x in cinema if x[0] != "!"])
  88.     tab = max(tab, max([len(x[0]) for x in cinema["!movies"]]))
  89.     tab += 3
  90.     if tab > 30:
  91.         tab = 30
  92.     print("Theatre:|", end = "")
  93.     for theatre in sorted(cinema):
  94.         if theatre[0] != "!":
  95.             if len(theatre) > tab:
  96.                 theatre = theatre[0:27] + "..."
  97.             print(str(theatre).ljust(tab, " "), end = "|")
  98.     print()
  99.     for time in sorted(cinema["!Timetable"]):
  100.         Time = BaseConvert(time, 10, 60)
  101.         print(Time.ljust(8, "-") + "|", end = "")
  102.         for theatre in sorted(cinema):
  103.             if theatre[0] != "!":
  104.                 x = cinema["!Timetable"][time][theatre]
  105.                 if len(x) > tab:
  106.                     x = x[0:27] + "..."
  107.                 print(x.ljust(tab, "-") +"|", end = "")
  108.         print()
  109.     print()
  110.  
  111. def SeatTranslator(Number_Or_SeatLabel, Total_Seats):
  112.     Seats = [int(x) for x in Total_Seats.split("*")]
  113.     Seats.append(Seats[0] * Seats[1])
  114.     alphabet = ["a", 'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
  115.     try:
  116.         Number_Or_SeatLabel = int(Number_Or_SeatLabel)
  117.     except ValueError:
  118.         try:
  119.             N = Number_Or_SeatLabel.split(",")[1]
  120.         except IndexError:
  121.             print("Seating script error")
  122.         else:
  123.             coord = [x for x in Number_Or_SeatLabel.split(",")]
  124.             if coord[0].lower() in alphabet:
  125.                 coord = [alphabet.index(coord[0].lower()) + 1, coord[1]]
  126.             coord = [int(x) for x in coord]
  127.             for i in range(2):
  128.                 if coord[i] > Seats[i]:
  129.                     return False
  130.             num = Seats[1] * (coord[0] - 1) + coord[1]
  131.             return num
  132.     else:
  133.         num = Number_Or_SeatLabel
  134.         col = num % Seats[1]
  135.         row = int(num / Seats[1]) + 1
  136.         if Seats[0] <= 26:
  137.             row = alphabet[row - 1]
  138.         coord = [str(row), str(col)]
  139.         return coord
  140.  
  141. def get_input(prompt,typ, bad_input,good_input):
  142.     if good_input:
  143.         SpecGood = True
  144.     else:
  145.         SpecGood = False
  146.     Sign = ""
  147.     if bad_input:
  148.         SpecBad = True
  149.         if typ == int or typ == float:
  150.             if bad_input[0] == "-":
  151.                 Sign = 1
  152.             elif bad_input[0] == "+":
  153.                 Sign = -1
  154.     else:
  155.         SpecBad = False
  156.     go = True
  157.     while go:
  158.         inp = input(prompt)
  159.         try:
  160.             inp = typ(inp)
  161.         except ValueError:
  162.             continue
  163.         else:
  164.             if SpecGood:
  165.                 if inp in good_input:
  166.                     if SpecBad:
  167.                         if inp not in bad_input:
  168.                             go = False
  169.                     else:
  170.                         go = False
  171.             else:
  172.                 go = False
  173.         if Sign and inp != 0:
  174.             if abs(inp) / inp != Sign:
  175.                 go = True
  176.     return inp
  177.  
  178. def EncryptInt(String, Key):
  179.     x = str(String)
  180.     x = [ord(i) for i in x]
  181.     Key = int(Key)
  182.     c = ''.join([chr((int(i if i != 10 else 11) ** Key) % 128) for i in x])
  183.     return c
  184.  
  185. def Input2Coords(Input):
  186.     if "," in Input:
  187.         coords = Input
  188.     else:
  189.         coords = Input[0] + "," + Input[1:]
  190.     return coords
  191. def SignIn():
  192.     global Member
  193.     global KEY
  194.     print("Enter your pin number:")
  195.     pin_enter = get_input(">>> ", str, [], [])
  196.     for member in members:
  197.         pin = EncryptInt(pin_enter, KEY)
  198.         if pin == members[member][0]:
  199.             print("Welcome {}!".format(member))
  200.             Member = member
  201.     if not Member:
  202.         print("User not found, please try again.")
  203. def AddMember(Name, Pin):
  204.     global KEY
  205.     global EncryptInt
  206.     global members
  207.     Pin = EncryptInt(Pin, KEY)
  208.     members[Name] = [Pin]
  209. def AddSessionToMember(member, session): # [Password, [<Session number>, Seat1, Seat2, Seat3, ..., SeatN]]
  210.     members[member].append(session)
  211. def UpdateMembers():
  212.     f = open("members.rtf", "w")
  213.     for member in members:
  214.         line = member + ", " + members[member][0]
  215.         if len(members[member]) > 1:
  216.             line += ", " + str(members[member][1])
  217.         line += "\n"
  218.         f.write(line)
  219.     f.close()
  220.  
  221. # ######################################################################################################################################################################################################
  222. # Log book: https://docs.google.com/document/d/1w21Rvb-Z3PomSWipWrbKzBwybN_JN6yUL4h8mY5CD2s/edit?usp=sharing
  223. print("Cinema Seater 2000.0")
  224. print("Loading cinemas...")
  225. import glob, os
  226. rates = {}#                      Rates: {Ticket: Price, ...}
  227. cinemas_list = []
  228. cinemas_all = {}#              Cinemas: {Cinema: [Movies: [[movie 1, length], [movie 2, length], ...], Theatre 1: [N.of seats, Seats type], Theatre 2: [.., ..], ..., Seats: [[seat type, percentage], ...], ...}
  229. for file in glob.glob("*.txt"):
  230.     if file != "rates.txt":
  231.         cinemas_list.append(file)
  232.     else:
  233.         f = open(file, 'r')
  234.         ratesFILE = f.read()
  235.         f.close()
  236.  
  237. for rate in ratesFILE.split("\n"):
  238.     try:
  239.         if rate:
  240.             ticket = rate.split("=")[0].strip()
  241.             price = rate.split("=")[1].strip()
  242.             rates[ticket] = int(price)
  243.     except ValueError:
  244.         print("Rates file not formatted correctly. Please create one before using the program.")
  245.  
  246. ##theatres_sorted = {} #[cinema[theatre, ...]]
  247. print("Organising Data...")
  248. for cinema in cinemas_list:   #Goes through cinemas in directory and loads movies and seats into cinemas_all
  249.     f = open(cinema, "r")
  250.     name = cinema[:-4]
  251.     FILE = f.read()
  252.     f.close()
  253.     CINEMA = {}
  254.     cont = False
  255.     if FILE[0:17].lower() != "available movies:":
  256.         continue
  257.     else:
  258.         SplitFILE = FILE.split(";")
  259.         CINEMA["!movies"] = []
  260.         CINEMA["!prices"] = {}
  261.         for movie in SplitFILE[1].split("\n"):# Loads movies into temp CINEMA["!movies"] ( = [...])
  262.             if movie:
  263.                 try:
  264.                     length = movie.split(",")[1]
  265.                     length = length.strip()
  266.                     movie = movie.split(",")[0]
  267.                     if movie[0] == '"' and movie[-1] == '"':
  268.                         length = int(length)
  269.                     CINEMA["!movies"].append([movie[1:-1], length])
  270.                 except IndexError:
  271.                     print("'" + cinema + "'" + " is not formatted correctly! (Available movie list, IndexError)")
  272.                     cont = True
  273.                     break
  274.                 except ValueError:
  275.                     print("'" + cinema + "'" + " is not formatted correctly! (Available movie list, ValueError)")
  276.                     cont = True
  277.                     break
  278.  
  279.  
  280.         if cont:
  281.             cont = False
  282.             continue
  283.         for theatre in SplitFILE[3].split("\n"):# Loads seats into temp CINEMA[<theatre>] ( = [N. of seats, seats type])
  284.             if theatre:
  285.                 try:
  286.                     theatre_name = theatre.split(") ")[0]
  287.                     NumSeats = theatre.split(" ")[1]
  288.                     seat_type = theatre.split(", ")[1]
  289.                     CINEMA[theatre_name] = [NumSeats, seat_type]
  290.                 except IndexError:
  291.                     print("'" + cinema + "'" + " is not formatted correctly! (Theatres list, IndexError)")
  292.                     cont = True
  293.                     break
  294.                 except ValueError:
  295.                     print("'" + cinema + "'" + " is not formatted correctly! (Theatres list, ValueError)")
  296.                     cont = True
  297.                     break
  298.  
  299.         if cont:
  300.             cont = False
  301.             continue
  302.         for seat in SplitFILE[5].split("\n"):
  303.             try:
  304.                 if seat:
  305.                     seat_price = seat.split("= ")[1][:-1]
  306.                     seat_name = seat.split("=")[0].strip()
  307.                     seat_price = float(seat_price)
  308.                     CINEMA["!prices"][seat_name] = seat_price/100
  309.             except IndexError:
  310.                 print("'" + cinema + "'" + " is not formatted correctly! (Prices, IndexError)")
  311.                 cont = True
  312.                 break
  313.             except ValueError:
  314.                 print("'" + cinema + "'" + " is not formatted correctly! (Prices, ValueError)")
  315.                 cont = True
  316.                 break
  317.         if cont:
  318.             cont = False
  319.             continue
  320.         cinemas_all[name] = CINEMA
  321. #                                   All cinemas, movies, seats and rates are loaded.
  322. for cinema in cinemas_all:
  323.     for movie in cinemas_all[cinema]["!movies"]:
  324.         A = movie
  325.         for Bcinema in cinemas_all:
  326.             for Bmovie in cinemas_all[Bcinema]["!movies"]:
  327.                 B = Bmovie
  328.                 if A[0] == B[0] and A[1] != B[1]:
  329.                     print("The movie '%s' occurs in more than one place with different time lengths.\nPlease ensure that both have the same name and time length if they are the same movie.\nIf they are different movies, make sure the names are different.\nThey will excluded from the program until fixed." %(A[0]))
  330.                     cinemas_all[cinema]["!movies"].remove(A)
  331.                     cinemas_all[Bcinema]["!movies"].remove(B)
  332. # Organising Timetable for movies:
  333.  
  334. print("Organising a timetable...")
  335.  
  336. try:
  337.     f = open("timetable.txt", "r")
  338. except FileNotFoundError:
  339.     pass
  340.     print("No timetable found, making new one.")
  341. else:
  342.     pass
  343.  
  344. sessions_all = []
  345. for cinema in cinemas_all:
  346.     sessions = [] #Sessions{[Movie, theatre, start time, end time, [seats])
  347.     TimeTable = {}#                                               seats: [A[1, 2, 3, 4, ...], B[1, 2, 3, ...]]
  348.     Theatres = [theatre for theatre in cinemas_all[cinema] if theatre[0] != "!"]
  349.  
  350.     for i in range(540, 1381, 5):
  351.         if len(str(i)) == 3:
  352.             i = '0' + str(i)
  353.         TimeTable[str(i)] = {}
  354.         for theatre in Theatres:
  355.             TimeTable[str(i)][theatre] = ""
  356.     N_Theatres = len(cinemas_all[cinema]) - 2
  357.     N_Movies = len(cinemas_all[cinema]["!movies"])
  358.  
  359.     Movies = [movie[0] for movie in cinemas_all[cinema]["!movies"]]
  360.     count = 0
  361.     for theatre in Theatres:
  362.         if count >= N_Movies:
  363.             count = 0
  364.         TimeTable['0540'][theatre] = Movies[count]
  365.         for time in range(540, 545 + cinemas_all[cinema]["!movies"][count][1], 5):
  366.             if len(str(time)) == 3:
  367.                 time = '0' + str(time)
  368.             TimeTable[str(time)][theatre] = Movies[count]
  369.         sessions.append([Movies[count], theatre, '0540', time, cinemas_all[cinema][theatre][1],[0 for x in range(int(cinemas_all[cinema][theatre][0].split("*")[0]) * int(cinemas_all[cinema][theatre][0].split("*")[1]))]])
  370.         count += 1
  371.     for time in sorted(TimeTable):
  372.         for theatre in TimeTable[time]:
  373.             time_in_20 = str(int(time) + 20)
  374.             if int(time_in_20) >= 1380:
  375.                 time_in_20 = time
  376.             if len(time_in_20) == 3:
  377.                 time_in_20 = "0" + str(time_in_20)
  378.  
  379.             if TimeTable[time][theatre] == "" and TimeTable[time_in_20][theatre] == "":
  380.  
  381.                 start = count
  382.                 skip = False
  383.                 if count >= N_Movies:
  384.                     count = 0
  385.                 while 1360 - cinemas_all[cinema]["!movies"][count][1] < int(time):
  386.                     if count == start:
  387.                         skip = True
  388.                         break
  389.                     count += 1
  390.                     if count >= N_Movies:
  391.                         count = 0
  392.                 if not skip:
  393.                     if TimeTable[str(time)][theatre] == "":
  394.                         for Ttime in range(int(time) + 20, int(time) + cinemas_all[cinema]["!movies"][count][1] + 20, 5):
  395.                             if len(str(Ttime)) == 3:
  396.                                 Ttime = '0' + str(Ttime)
  397.                             TimeTable[str(Ttime)][theatre] = Movies[count]
  398.                         sessions.append([Movies[count], theatre, time, Ttime, cinemas_all[cinema][theatre][1] ,[0 for x in range(int(cinemas_all[cinema][theatre][0].split("*")[0]) * int(cinemas_all[cinema][theatre][0].split("*")[1]))]])
  399.  
  400.                 count += 1
  401.                 if count >= N_Movies:
  402.                     count = 0
  403.     cinemas_all[cinema]["!Timetable"] = TimeTable
  404.     cinemas_all[cinema]["!sessions"] = sessions
  405.     for session in sessions:
  406.         new_session = [cinema]
  407.         for p in session:
  408.             new_session.append(p)
  409.         sessions_all.append(new_session)
  410.  
  411.  
  412. members = {}
  413. # Load Members
  414. try:
  415.     with open("members.rtf","r") as f:
  416.         for line in f:
  417.             if not line.strip():
  418.                 continue
  419.             parts = line.split(",")
  420.             name = parts[0].strip(' ')
  421.             pas = parts[1].strip(' ')
  422.             members[name] = [pas]
  423. except FileNotFoundError:
  424.     print("Members file not found, making new one.")
  425.     f = open("members.rtf","w")
  426.     f.close()
  427. # Everything is sorted by now
  428.  
  429. print("Ready!")
  430. # ###########################################################
  431. print("\n")
  432. choice = -1
  433. Member = False
  434. while choice != 0:
  435.     print("What would you like to do?:")
  436.     print("0) Exit")
  437.     print("1) Book a movie")
  438.     print("2) Look at session times")
  439.     print("3) Settings")
  440.     if Member:
  441.         print("4) Review movies/Sign out")
  442.     else:
  443.         print("4) Sign in as Member")
  444.     print("Enter a number:")
  445.     choice = get_input(">>> ", int, [-1], [0, 1, 2, 3, 4])
  446.     if choice == 1:#                                                                                       Choosing a movie                 #################
  447.         searching = True
  448.         while searching:
  449.             print("Enter a search term to search for movies, or leave blank to show all movies")
  450.             search = input(">>> ")
  451.             if search:
  452.                 results = []
  453.                 for cinema in cinemas_all:
  454.                     for movie in cinemas_all[cinema]["!movies"]:
  455.                         if search.lower() in movie[0].lower() and movie[0] not in results:
  456.                             results.append(movie[0])
  457.                 if results:
  458.                     count = 1
  459.                     for result in results:
  460.                         print(str(count) + ")", result)
  461.                         count += 1
  462.                     print("Enter the number of the movie to select it or enter 0 to search again:")
  463.                     movie_choice = get_input(">>> ", int, [-1], [x for x in range(count + 1)])
  464.                     if movie_choice != 0:
  465.                         searching = False
  466.                         movie_choice = results[movie_choice - 1]
  467.                 else:
  468.                     print("No results found")
  469.             else:
  470.                 for cinema in sorted(cinemas_all):
  471.                     print(cinema + ":")
  472.                     for movie in cinemas_all[cinema]["!movies"]:
  473.                         print("\t" + movie[0] + " (" + str(movie[1]) + " mins)")
  474.         #  Movie name chosen
  475.         available_cinemas = []
  476.         for cinema in cinemas_all:
  477.             for movie in cinemas_all[cinema]["!movies"]:
  478.                 if movie[0] == movie_choice:
  479.                     available_cinemas.append(cinema)
  480.         if len(available_cinemas) == 1:
  481.             print("Your movie is currently only available in '%s', please select a time to continue." %(available_cinemas[0]))
  482.             cinema_choice = available_cinemas[0]
  483.         else:
  484.             print("Your movie is available in the following cinemas:")
  485.             count = 1
  486.             for cinema in sorted(available_cinemas):
  487.                 print("\t" + str(count) + ")", cinema)
  488.                 count += 1
  489.             print("Choose one:")
  490.             cinema_choice = sorted(available_cinemas)[get_input(">>> ", int, [-1], [int(x) for x in range(1, len(available_cinemas) +1)]) - 1]
  491.             print(cinema_choice)
  492.         count = 1
  493.         available_sessions = []
  494.         for session in cinemas_all[cinema_choice]["!sessions"]:
  495.             if session[0] == movie_choice:
  496.                 print("%i) %s - %s (theatre: %s, %s seats)" %(count, BaseConvert(session[2], 10, 60), BaseConvert(session[3], 10, 60), session[1], session[4]))
  497.                 count += 1
  498.                 available_sessions.append(session)
  499.         session_choie = get_input(">>> ", int, [-1],[x for x in range(1, count)])
  500.         session_choie -= 1
  501.         session_choie = available_sessions[session_choie]
  502.         # If member, Prices are all at 80%
  503.         if not Member:
  504.             print("Are you a member? (Y/N): ")
  505.             if_member = get_input(">>> ", str, [], ["y","Y","yes","Yes","no","No","n","N"])
  506.             if if_member in ["y","Y","yes","Yes"]:
  507.                 SignIn()
  508.             else:
  509.                 print("Sign up as a member for discounts on all your movies!")
  510.         print("Choose tickets:")
  511.         count = 0
  512.         session_rates = [rates[x] * cinemas_all[cinema_choice]["!prices"][session_choie[4]] for x in sorted(rates)]
  513.         cost = 0
  514.         tickets = 0
  515.         for rate in sorted(rates):
  516.             Price = rates[rate] * cinemas_all[cinema_choice]["!prices"][session_choie[4]]
  517.             if Member:
  518.                 Price = Price * 0.8
  519.             print("%s, $%s" %(rate, StripNumber(Price)))
  520.             quant = get_input("Quantity: ", int, ["-"], [])
  521.             cost += quant * session_rates[count]
  522.             tickets += quant
  523.             count += 1
  524.         print("Total: %f" %(cost))
  525.         print("Choose your seats: ")
  526.         Seat_Area = [x for x in cinemas_all[cinema_choice][session_choie[1]][0].split("*")]
  527.         nRows = int(Seat_Area[0])
  528.         nCols = int(Seat_Area[1])
  529.         nSeats = nRows * nCols
  530.         print("   " + "Screen".center(nCols * 3, "-"))
  531.         print("    " + ''.join([str(x+1).ljust(3, " ") for x in range(nCols)]))
  532.         number = 1
  533.         for seatR in range(1, nRows + 1):
  534.             print(" " + SeatTranslator(number, "*".join(Seat_Area))[0].upper(), end = ' ')
  535.             for seatC in range(1, nCols + 1):
  536.                 if session_choie[5][number - 1] == 0:
  537.                     print(" O ", end = "")
  538.                 else:
  539.                     print(" X ", end = "")
  540.                 number += 1
  541.             print()
  542.         print("You have {0} ticket(s), please select {0} seat(s):".format(tickets))
  543. ##        chosen_seats = []
  544.         print("To choose seats, type in either letter-number coordinates (eg. A3, H4),\nor if the rows are numbered (and not lettered) use Row,Column (eg. 1,3 or 15,21) ")
  545.         selected_seats = []
  546.         for i in range(tickets):
  547.             seat_choice = SeatTranslator(Input2Coords(get_input(">>> ", str, [], [])), "{}*{}".format(nRows, nCols))
  548.             while not seat_choice or session_choie[5][seat_choice - 1] == 1:
  549.                 if not seat_choice:
  550.                     print("Invalid seat number")
  551.                 elif session_choie[5][seat_choice - 1] == 1:
  552.                     print("Seat is already taken. Please choose another.")
  553.                 seat_choice = SeatTranslator(Input2Coords(get_input(">>> ", str, [], [])), "{}*{}".format(nRows, nCols))
  554.             session_choie[5][seat_choice - 1] = 1
  555.             selected_seats.append(seat_choice - 1)
  556.         if Member:
  557.             SessionToAdd = [sessions_all.index([cinema_choice] + session_choie)]
  558.             for seat in selected_seats:
  559.                 SessionToAdd.append(seat)
  560.             AddSessionToMember(Member, SessionToAdd)
  561.  
  562.  
  563.     elif choice == 4:
  564.         if Member:
  565.  
  566.             print("Sign out? (Y/N)")
  567.             confirm = get_input(">>> ", str, [], ["y","Y","yes","Yes","no","No","n","N"])
  568.             if confirm in ["y","Y","yes","Yes"]:
  569.                 print("Signing out, catchya later {}.".format(Member))
  570.                 Member = False
  571.         else:
  572.             if_member = get_input("Are you a member? (Y/N) ", str, [], ["y","Y","yes","Yes","no","No","n","N"])
  573.             if if_member in ["y","Y","yes","Yes"]:
  574.                 SignIn()
  575.             else:
  576.                 print("Enter your details, becoming a member is free, quick and easy and only costs $35.99!!")
  577.                 nam = get_input("Username: ",str, [], [])
  578.                 while nam in members:
  579.                     print("Username is being used, please select a different one")
  580.                     nam = get_input("Username: ",str, [], [])
  581.                 pin = get_input("Pin number (at least 4 digits): ", int, [], [])
  582.                 while len(str(pin)) < 4:
  583.                     print("Pin must be at least 4 digits.")
  584.                     pin = get_input("Pin number: ", int, [], [])
  585.                 members[nam] = str(pin)
  586.                 AddMember(nam, pin)
  587.  
  588.     elif choice == 3:
  589.         print("Settings:")
  590.         print("")
  591.     elif choice == 2:
  592.         print("Printing times for all cinemas:")
  593.         for cinema in cinemas_all:
  594.             print("Cinema:", cinema)
  595.             PrintTimeTable(cinemas_all[cinema])
  596.     UpdateMembers()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement