Incomplete Code 8 Aug

 #lolz

import pickle

dict = {}

#Add Movie
def Addmov(ch):
    if ch == 1:
        with open("MOV.dat","wb") as f:
            while True:
                movienum = int(input("Enter the Movie number:"))
                name = input("Enter the Name:")
                rating = input("Enter the Movie rating:")
                global dict
                dict[movienum] = name,rating
                print("Do you wanna Continue??")
                i = input("Y/N:")
                l = i.upper()
                if l == "N" :
                    break
                if l == "Y":
                    continue
            pickle.dump(dict,f)
#show data
def display(ch):
    with open("MOV.dat","rb") as f:
        if ch == 2:
            ok = pickle.load(f)
            print(ok)

#Modify
def modify(ch):
    with open("MOV.dat","rb") as f:
        if ch == 3:
            o = pickle.load(f)
            var = input("Give the movie number\nwhich you want to modify:")
       
            for x in o:
                if x == var:
                    pe = input("Enter Movie Name:")
                    te = input("Enter the Rating:")
                    global dict
                    dict[x] = pe,te


#menu
while True:
    txt = "MENU"
    x = txt.center(30, " ")
    print(x)
    print("1)Add Movie\n2)Show Data\n3)Modify\n4)Search\n5)Delete\n6)Exit")

#driver
    ch = int(input("Enter the choice:"))
    Addmov(ch)
    display(ch)
    modify(ch)




©imanav07

Comments

Post a Comment