Theater Management Using Python Incorporating NumPy and Pandas
Theater Management Using Python Incorporating NumPy and Pandas
Cse A
RA2311003020014
Source code: -
import numpy as np
import pandas as pd
cc = conn.cursor()
LOGIN = False
PA = None
UID = None
def sign_up():
u=0
f = cc.fetchall()
for i in f:
if i[3] == v_uid:
u += 1
if u == 0:
v_ins = "INSERT INTO users VALUES('{}','{}',{}, {},'{}')".format(v_fn, v_ln, v_pn, v_uid, v_pwd)
LOGIN = True
PA = v_pwd
UID = v_uid
cc.execute(v_ins)
conn.commit()
def login():
if not LOGIN:
f = cc.fetchall()
for i in f:
user_id = i[3]
user_pwd = i[4]
if user_id == u:
if user_pwd == p:
UID = int(user_id)
LOGIN = True
PA = p
break
else:
print("Password is Incorrect.")
break
else:
else:
def booking():
if LOGIN:
print("""Movies Running:
1: John Wick 4
2: Leo
3: Mark Antony
4: The Marvels
5: Avengers Endgame
6: Spiderman
7: Jailer""")
print("""Classes Available:
1: Classic
2: Premium
3: First Class
4: Majestic""")
class_selection = classes[class_choice - 1]
if PA == password:
print("Ticket Booked!")
b_ins = "INSERT INTO booking VALUES({}, '{}', {}, {}, {}, '{}')".format(
cc.execute(b_ins)
conn.commit()
else:
else:
else:
print("Log in to Proceed")
def display_users():
users_data = cc.fetchall()
column_names = ["First Name", "Last Name", "Phone Number", "User ID", "Password"]
print(users_df)
def main():
1: SIGN UP
2: LOG IN
3: Ticket Booking
4: Display Users
5: LOG OUT
6: Exit""")
while True:
sign_up()
elif choice == 2:
login()
elif choice == 3:
booking()
elif choice == 4:
display_users()
elif choice == 5:
LOGIN = False
PA = None
UID = None
elif choice == 6:
break
else:
print("Invalid Choice")
if __name__ == "__main__":
main()
Working of the program: -
The provided code is designed to interact with a database, allowing users to sign up, log in, book
tickets, and display user information. The output of the program would be based on the user's
interactions with the menu options and database operations.
Entering user details (first name, last name, phone number, user ID, and password).
If the user ID is unique, the program will confirm successful sign-up. Otherwise, it
will prompt that the UID already exists.
After logging in, users can select a movie, enter their details (name, phone number,
tickets, etc.), and book tickets if the password provided matches the stored
password.
Choosing this option will display the user information stored in the 'users' table,
including first name, last name, phone number, user ID, and password.
Logging out will reset the session, setting LOGIN, PA, and UID to None, effectively
logging the user out.
The actual output of the program will depend on the user's actions, such as signing up, logging in,
booking tickets, or viewing user information. The displayed information will include various prompts,
confirmation messages, and database-related outputs (e.g., successful inserts or queries).
Additionally, any errors or incorrect inputs would prompt respective error messages to guide the
user.
Example Output : -
1: SIGN UP
2: LOG IN
3: Ticket Booking
4: Display Users
5: LOG OUT
6: Exit
1: John Wick 4
2: Leo
3: Mark Antony
4: The Marvels
5: Avengers endgame
6: Spiderman
7: Jailer
Classes Available:
1: Classic
2: Premium
3: First Class
4: Majestic
Ticket Booked!
Ratings(0-5): 4