CPSC 3400 Assignment #3

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (8 votes)

P3 exercises your understanding of regular expressions and Python.
Submitted programs must:
1) provide the requested functionality
2) be appropriately documented (thorough but concise)
3) use Python constructs as intended (do NOT write a C-style program)
• Use re
4) be relatively robust

ALL ASSUMPTIONS SHOULD BE REASONABLE AND CLEARLY STATED
DO NOT HARD CODE

Write a Python program that:
1) examines the contents of a text file (name specified on CL)
2) identifies all valid prices that appear in the file
A valid price may be represented in the following forms
$x, where x is a string of one or more digits
with the restriction that the 1st digit is NOT zero
$x.bc, where x is as described above, and b & c are single digits
Invalid formats include
$y, where y is a string of one or more digits but the 1st digit is zero
$x.b, where x is as described above, and
b is a string of 1 or (3 or more) digits
$y.b, where y is as described above, and
b is a string of 1 or (3 or more) digits
3) outputs the prices into 3 files:
a) bucks.txt: all prices in the form $x
b) sale.txt, all prices in the form $x.99
c) misc.txt all other valid prices

Each submitted program will be tested on the same input file
TEST YOUR PROGRAM BEFORE SUBMISSION

Name your Python file: P3.py AND upload to Canvas