Def the update () :
F=open (' student. TXT ', 'r', encoding="utf-8")
Phone=f.r ead ()
Phone=eval (phone)
Print (phone)
F. lose ()
Print (' file read successful ')
Return phone
Phones=update ()
Def write (info) :
F=open (' student. TXT ', 'w', encoding="utf-8")
F.w rite (STR (info))
F. lose ()
Print (' synchronization has been finished)
While True:
Print (' this is a mobile phone management system ')
Print (' 1. Check the inventory mobile phone brands')
Print (' 2. The stock ')
Print (' 3. Shipment)
Print (' 4. Modify the inventory information ')
Print (' 5. Delete mobile phone brands')
Print (' 6. Exit ')
Option=eval (input (' please enter you want to do))
If the option==1:
For phone in phones:
Print (phone)
If the option==2:
Name=input (" please enter the mobile phone brand)
Num=eval (input (' please enter the deposit amount))
For phone in phones:
If the name in the phone. The keys () :
Total=phone [name] + num
Phone [name]=total
Break
The else:
Phones. Append ({name: num})
Print (phones)
Write (phones)
If the option==3:
Name=input (' please enter take mobile phone brands')
Num=eval (input (' please enter the number '))
For phone in phones:
If the name in the phone. The keys () :
If num & lt;=phone [name] :
Total=phone [name] - num
Phone [name]=total
Write (phones)
Print (' please find ')
The else:
Print (' insufficient inventory)
The else:
Print (' the phone does not exist ')
If the option==4:
Name=input (" please enter the mobile phone brand)
Num=eval (input (' please enter the number '))
For phone in phones:
If the name in the phone. The keys () :
Phone [name]=num
Write (phones)
Break
The else:
Print (' the brand does not exist ')
If the option==5:
Name=input (" please enter the mobile phone brand)
For phone in phones:
If the name in the phone. The keys () :
Phones. Remove (phone)
Write (phones)
Break
The else:
Print (' no ')
If the option==6:
Print (' withdrawn ')
Break