Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python program t4.py file apple 1 1 ball art dog & pen rat 4 apple 1@. carrot ! orange ant ant ant ball stick pen

Python program

image text in transcribed

t4.py file

apple

1

1

ball

art

dog

&

pen

rat

4

apple

1@.

carrot

!

orange

ant

ant

ant

ball

stick

pen

_

$a

***

goodbye

image text in transcribed

The Program Spec Write a program that reads in a filename provided by the user, opens it and reads all of the lines. Create a dictionary to hold the line numbers for each valid identifier found. Your solution will need to process each line to determine whether a valid identifier exists on that line and if so, record both the line number and identifier found in the dictionary. A valid identifier must be a string consisting of only letters, numbers and underscores. If a line contains an invalid identifier no record is made in the dictionary. If a line contains a valid identifier already recorded in the dictionary append the line number to the dictionary log of where the identifier was found. Input Error Checking: For simplicity a python file is provided to feed into your dictionary generator. The filename is t4.py provided in the link below. Test Run Requirements: Use the provided t4.py file as your test run validator. Here are some other tips and requirements 1. Keep provided test file intact 2. Use t4.py as your input test file to generate submission run output 3. Verify identifiers are valid; ignore if invalid Here is a sample run: apple: [1, 11] art: [5

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

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

Students also viewed these Databases questions

Question

when is the best time to back up and how it should be done

Answered: 1 week ago

Question

how would you have done things differently?

Answered: 1 week ago

Question

What were the reasons for your conversion or resistance?

Answered: 1 week ago

Question

How was their resistance overcome?

Answered: 1 week ago