CS192 Programming Essentials – Week 5 Assignment
$9.00
Description
Create a program utilizes functions to append, delete, and index methods discussed this week. Your program should allow the user to add, remove or edit an item from a list. Your program should also print the list values and display a menu for the user to select a menu option. You will need to complete the following steps in your program:
1. Create a list called “transactions”
2. Create a function to display a menu so that the user can select 1 of 5 options:
· Add Transaction
· Delete Transaction
· Edit Transaction
· Display Transactions
· Exit the Program
3. Create a function to add a transaction to the list
· Ask user to enter transaction key
· Append transaction key to list
4. Create a function to delete a transaction from the list
· Ask user to enter transaction key
· Delete transaction key from list
5. Create a function to edit a transaction from the list
· Ask user to enter transaction key
· Edit existing transaction key
1. Create a function to print the list
· Print all transaction keys in the list
2. Repeatedly display the menu selections if the user has not selected option 5 to exit the program.
Examples of the program’s input and output is shown below:
**********Main Menu***********
1. Add Transaction
2. Delete Transaction
3. Edit Transaction
4. Display Transactions
5. Exit the Program
Choose a menu option from 1-4 or 5 to exit the program: 1
Enter the transaction key to add: 1234
**********Main Menu***********
1. Add Transaction
2. Delete Transaction
3. Edit Transaction
4. Display Transactions
5. Exit the Program
Choose a menu option from 1-4 or 5 to exit the program: 4
Displaying transaction keys list:
1234
**********Main Menu***********
1. Add Transaction
2. Delete Transaction
3. Edit Transaction
4. Display Transactions
5. Exit the Program
Choose a menu option from 1-4 or 5 to exit the program: 3
Enter the transaction key to edit: 1234
Enter the new transaction key to add: 5678
**********Main Menu***********
1. Add Transaction
2. Delete Transaction
3. Edit Transaction
4. Display Transactions
5. Exit the Program
Choose a menu option from 1-4 or 5 to exit the program: 5
Exiting program.
SCREENSHOTS
SOLUTION
PAYMENT
The solution consists of:
A report word document for this assignment
All Python programs in case you want to run theses programs on your computer.
Screenshots while running programs
Attachments [Move over files to preview content of those files]
CS192_WEEK_5.zip (188.93 KB)
CS192-Week-5-Screenshot-1.png
CS192-Week-5-Screenshot-2.png
CS192_Week5_Report.docx
Pycharm Project
CS192Week5
.idea
.gitignore
CS192Week5.iml
inspectionProfiles
profiles_settings.xml
misc.xml
modules.xml
workspace.xml
week5.py
Python code
week5.py
Preview week5.py
xxx xxx_xxxxxxxxxxx(xxxxxxxxxxxx):
xxx = xxx(xxxxx(‘xxxxx xxx xxxxxxxxxxx xxx xx xxx: ‘))
xx xxx xx xxxxxxxxxxxx:
xxxxx (‘xxxxxxxxx xxxxxxxxxxx xxx %x’ % xxx)
xxxx:
transactions.append(key) # add key to transactions list
# Create a function to delete a transaction from the list def delete_transaction(transactions): key = int(input(‘Enter the transaction key to delete: ‘)) if key not in transactions: print (‘transaction key %s not exists’ % key) else: transactions.remove(key) # remove key from transactions
# Create a function to edit a transaction from the list def edit_transaction(transactions):
xxx = xxx(xxxxx(‘xxxxx xxx xxxxxxxxxxx xxx xx xxxx: ‘))
xx xxx xxx xx xxxxxxxxxxxx:
xxxxx (‘xxxxxxxxxxx xxx %x xxx xxxxxx’ % xxx)
xxxx:
xxx_xxx = xxx(xxxxx(‘xxxxx xxx xxx xxxxxxxxxxx xxx xx xxx: ‘))
xxxxx = xxxxxxxxxxxx.xxxxx(xxx) # xxxx xxx xxxxx xx xxx xx xxxxxxxxxxxx
Preview week5.py
xxx xxx_xxxxxxxxxxx(xxxxxxxxxxxx):
xxx = xxx(xxxxx(‘xxxxx xxx xxxxxxxxxxx xxx xx xxx: ‘))
xx xxx xx xxxxxxxxxxxx:
xxxxx (‘xxxxxxxxx xxxxxxxxxxx xxx %x’ % xxx)
xxxx:
transactions.append(key) # add key to transactions list
# Create a function to delete a transaction from the list def delete_transaction(transactions): key = int(input(‘Enter the transaction key to delete: ‘)) if key not in transactions: print (‘transaction key %s not exists’ % key) else: transactions.remove(key) # remove key from transactions
# Create a function to edit a transaction from the list def edit_transaction(transactions):
xxx = xxx(xxxxx(‘xxxxx xxx xxxxxxxxxxx xxx xx xxxx: ‘))
xx xxx xxx xx xxxxxxxxxxxx:
xxxxx (‘xxxxxxxxxxx xxx %x xxx xxxxxx’ % xxx)
xxxx:
xxx_xxx = xxx(xxxxx(‘xxxxx xxx xxx xxxxxxxxxxx xxx xx xxx: ‘))
xxxxx = xxxxxxxxxxxx.xxxxx(xxx) # xxxx xxx xxxxx xx xxx xx xxxxxxxxxxxx
Price: $19
You May Also Like:
CS192 Programming Essentials – Week 1 Assignment
CS192 Programming Essentials – Week 2 Assignment
CS192 Programming Essentials – Week 3 Assignment
CS192 Programming Essentials – Week 4 Assignment
CS192 Programming Essentials – Week 6 Assignment
CS192 Programming Essentials – Week 7 Assignment
CS192 Programming Essentials – Week 8 Assignment
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.