Question: This for python. only use import sys or sysargv NO INPUT FUNCTION Question 4 (40 points) Assume you were given the following data about customer
This for python. only use import sys or sysargv NO INPUT FUNCTION


Question 4 (40 points) Assume you were given the following data about customer visits to a grocery store. After the customer's name, the first 3 inputs are the number of visits to the store per month and the last is whether or not the customer belongs to the store's frequent shopper club (Kris does as indicated by the "yes" below). The data is provided at runtime as sys.argv. Kris 4 53 Jo-Marie 6 5 5 Gabe 2 2 2 Here is what you can assume I will type in command prompt: python test1-4.py Kris 4 5 3 python test1-4.py Jo-Marie 6 cat 5 python test1-4.py Gabe 2 2 2 Write a script called test1-4.py that does the following: a. Calculate the average visits per month (4 for Kris) as a parameter and returns a message according to the frequency of visits. The average number of visits may be a decimal. b. When the average is at least 4, the shopper is labeled a super shopper. c. Uses try/except to ensure that the second, third, and fourth parameters (4, 5, 3 for Kris) passed at runtime is actually a number. The output for the above input should exactly match the following: Kris shops on average 4 times per month and is a super shopper. Invalid data. Gabe shops on average 2 times per month. The output for running this with 'cat' instead of a number should exactly match the following: Invalid data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
