logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Kevin BatesTechnical writing
(5/5)

847 Answers

Hire Me
expert
Cesar MeyerStatistics
(5/5)

608 Answers

Hire Me
expert
Ramish RazzaScience
(4/5)

761 Answers

Hire Me
expert
Ashton HamiltonEnglish
(5/5)

844 Answers

Hire Me
Python Programming
(5/5)

Create a function called that has a parameter representing a filename.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Problem #1

This first problem is admittedly pretty uninteresting. It's just to get us practicing and reviewing various Python concepts and techniques that we have been learning.

Reminder: Again, remember not to try to do too much at once. Get one small bit of functionality working, and then work on the next bit. Even within each of the itemized requirements below, you may want to just do part of each one, test it well, before working on the next little bit of functionality.

Create a function called that has a parameter representing a filename.

The function should open the file and then do the following:

 

Print: (where 'ZZZZ' is the name of the file). Note that the

filename is in quotes. You can also see this in the output example below.

Place the code where you open the file, read in the information you need, and close the file inside an try/catch exception block. Your exception should catch a FileNotFoundError . If this exception occurs, output:

again where ZZZZ is the name of

the file. And your function should immediately end.

If the file has less than 10 lines, your function should simply output:

(where ZZZ is the number of lines). Your function should then

immediately terminate.

Now if the file being opened has 10 lines or more, you will do the following:

For each line, output either if the line is less than 25 characters, output

if the line is 25 or more characters, and less than 50 characters, output if the line is 50 or more characters.

You should do this only for the first 10 lines of the file. So even if the file has many, many lines, only output the values for the first 10 lines.

 

Each statement should be preceded by

number. Again, see the sample test output below.

 

where Z represents the line

 

You should find yourself using format strings for just about all of your statements.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

426 Experts Online