Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

File Update: a List of Strings 1. Code a comment with the python program name, author and course. 2. Define readShoeFile() composed of statements to

File Update: a List of Strings

1. Code a comment with the python program name, author and course.

2. Define readShoeFile() composed of statements to :

declare shoeList

with open \"shoe.txt\" for reading as shoeFile have

for shoe line in shoeFile, replace(' ' in each line), then

have shoesList append each line input, then return shoeList

3. Define printShoeList with parameter shoeList and is to contain a loop

for printing each shoe item and it's index value.

4. Define a function named writeShoeFile with the parameter shoeList.

Open \"shoe.txt\" for writing as shoeFile followed by a statement for shoe in

shoeList to repeatedly have shoeFile invoke write (shoe) as separate lines.

5. Define addShoe with parameter shoeList to include an input() for a shoe name

(e.g. Merrill), followed by having the shoeList append(shoe), invoke

writeShoeFile with parameter(shoeList), then print a confirmation message.

6. Define deleteShoe(shoeList) that has statements to: assign to an index a

shoe line number from user input, and assign to shoe item the value

returned by having shoeList \"pop\" that shoe line number, invoke

writeShoeFile (shoeList), and print a delete confirmation.

7. Define printMenu() to print a title line followed by menu items for:

Print Shoe List (p)

Add a Shoe (a)

Delete a Shoe (d)

Exit (x)

8. Define a main function with statements to:

assign to shoeList the value returned by invoking readShoeFile,

next invoke printMenu(),

then repeatedly:

assign a menu choice returned by input() followed by

a selection structure with tests for values:

'p' for printShoes (shoes),

'a' for addShoe(shoes),

'd' for deleteShoe(shoes), or

'x' exit

invoke main()

-------------------------------------------------------------

*shoe.txt (to be stored in the same folder as fileUpdate.py):

Adidas

Asics

Brooks

Keds

Larnmern

New Balance

OTU

Rockport

Ryka

Skechers

Slow Man

Under Armour

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions