anirudhp06

Grocery 1.0

Apr 23rd, 2020
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.86 KB | None | 0 0
  1. """Now i no longer edit this script as this is now a legacy and advanced version of the same program is released... check my paste bin account for newer version of this program"""
  2.  
  3. import sys
  4. class grocery:
  5.  
  6.     def input(self):
  7.         choice=0
  8.         a=[]
  9.         b=[]
  10.         while choice!=5:
  11.             print("\n\n1.Insert Grocery\n2.Display Bucket List\n3.Total Bill\n4.Remove item\n5.Exit Store")
  12.             choice=int(input("\nEnter Choice:"))
  13.             if choice==1:
  14.                 print("Name of Item:")
  15.                 nome = input()
  16.                 a.append(nome)
  17.                 print("Rate of Item:")
  18.                 rate = int(input())
  19.                 b.append(rate)
  20.             elif choice==2:
  21.                 if a == []:
  22.                     print("Your Bucket List is empty! Insert Item")
  23.                 else:
  24.                     for i in range(0, len(a)):
  25.                         print("{},{}/-".format(a[i], b[i]))
  26.             elif choice==3:
  27.                 bill = 0
  28.                 for i in b:
  29.                     bill += i
  30.                 print("Your Bill is :", bill,"/-")
  31.             elif choice==4:
  32.                 if a == []:
  33.                     print("Your Bucket List is empty! Insert Item")
  34.                 else:
  35.                     itm = ""
  36.                     print("Enter Item to be Deleted:")
  37.                     itm = input()
  38.                     if itm in a:
  39.                         index = a.index(itm)
  40.                         a.remove(itm)
  41.                         b.remove(b[index])
  42.                         print("Bucket List Updated")
  43.                     else:
  44.                         print("Given item not present in Bucket List")
  45.             elif choice==5:
  46.                 print("Program Terminated5")
  47.                 sys.exit()
  48.             else:
  49.                 print("Try Again")
  50. obj=grocery()
  51. obj.input()
Add Comment
Please, Sign In to add comment