Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7784593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:07:10+00:00 2026-06-01T20:07:10+00:00

The assignment isPhase 1 – Management mode When the user selects management mode, they

  • 0

The assignment isPhase 1 – Management mode
When the user selects management mode, they should be allowed to do the following:

  1. Add a new product to the list (must also add how many of the item
    and its cost)
  2. Remove a product from the list
  3. Change the quantity of an item

    def mang (grocerystock):
    
    mangchoice=int(input("What would you like to do? \n 1):Add a new product to the list? \n 2): Remove a product from the list?  \n 3: Change the quantity of an item  \n 4): Change the price of an item  \n  5): View items and their quantity and price"))
    
    if mangchoice == 1:
        infile=open("grocery_stock.txt", 'a')
        name=input("Please enter the new product's name would you like to add:")
        quant=int(input("Please enter the new product's quantity"))
        price=float(input("Please enter the new product's price"))
        grocerystock[0]=name
        grocerystock[1]=quant
        grocerystock[2]=price
        gS=str(grocerystock)
        gs=gS.strip("[',']")
        infile.write(gs + '\n')
    if mangchoice == 2:
        namedelete=input("what item would you like to remove")
        a=open("grocery_stock.txt", 'r')
        data_list= a.readlines()
        a.close()
        print (data_list)
        del data_list[namedelete]
        b= open ("grocery_stock.txt", 'w')
        b.writelines(data_list)
        b.close()
    def intro():
    choice=(int(input("Would you like to go to Managerial mode or Shop mode?(press 1 for Managerial and 2 for shop mode, to quit press 3)")))
    
    
    if choice == 1:
        print ('lets go')
        mang(grocerystock)
    elif choice == 0 :
        print ('loser')
    
    grocerystock= ["","",""]
    
    intro()
    

This is all the code i have written so far any ideas? The code that i am trying to delete is under if mangchoice == 2:

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:07:11+00:00Added an answer on June 1, 2026 at 8:07 pm

    In Python3, input returns a string. It looks like you need to convert it to an int:

    namedelete = int(input("what item would you like to remove"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My assignment is to create a basic contact list program that lets the user
our assignment is to implement a linked list class to do the following with
The assignment at my first year uni computing course says my program should read
In a homework assignment we were asked to add a system call to the
For an assignment, i have written the following code in recursion. It takes a
I'm doing an assignment that requires me to complete the following block of code:
The assignment is to define a function that accepts a single list as a
Assignment of NSFileOwnerAccountName and NSFileGroupOwnerAccountName does not work? The directory created defaults to my
My assignment requires that I have an ER diagram that shows the dependencies between
For a school assignment I have to write x86 assembly code, except I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.